Search Results for

    Show / Hide Table of Contents

    Class ConsoleColoring

    Console coloring extensions

    Inheritance
    object
    ConsoleColoring
    Namespace: Terminaux.Base.Extensions
    Assembly: Terminaux.dll
    Syntax
    public static class ConsoleColoring

    Properties

    | Edit this page View Source

    AllowBackground

    Whether applications are allowed to set the current background color or not

    Declaration
    public static bool AllowBackground { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    ConsoleSupportsTrueColor

    If you are sure that the console supports true color, or if you want to change your terminal to a terminal that supports true color, change this value.

    Declaration
    public static bool ConsoleSupportsTrueColor { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    CurrentBackgroundColor

    Current background color

    Declaration
    public static Color CurrentBackgroundColor { get; }
    Property Value
    Type Description
    Color
    | Edit this page View Source

    CurrentForegroundColor

    Current foreground color

    Declaration
    public static Color CurrentForegroundColor { get; }
    Property Value
    Type Description
    Color

    Methods

    | Edit this page View Source

    DetermineTrueColorFromUser()

    Asks the user to decide whether the terminal supports true color

    Declaration
    public static void DetermineTrueColorFromUser()
    | Edit this page View Source

    GetGray(ColorContrastType)

    Gets the gray color according to the brightness of the background color

    Declaration
    public static Color GetGray(ColorContrastType contrastType = ColorContrastType.Light)
    Parameters
    Type Name Description
    ColorContrastType contrastType

    Contrast type

    Returns
    Type Description
    Color
    | Edit this page View Source

    LoadBack()

    Loads the background

    Declaration
    public static void LoadBack()
    | Edit this page View Source

    LoadBack(Color, bool)

    Loads the background

    Declaration
    public static void LoadBack(Color ColorSequence, bool Force = false)
    Parameters
    Type Name Description
    Color ColorSequence

    Color sequence used to load background

    bool Force

    Force set background even if background setting is disabled

    | Edit this page View Source

    LoadBackDry()

    Loads the background dryly

    Declaration
    public static void LoadBackDry()
    | Edit this page View Source

    LoadBackDry(Color, bool)

    Loads the background dryly

    Declaration
    public static void LoadBackDry(Color ColorSequence, bool Force = false)
    Parameters
    Type Name Description
    Color ColorSequence

    Color sequence used to load background

    bool Force

    Force set background even if background setting is disabled

    | Edit this page View Source

    RenderResetBackground()

    Gets a sequence that resets the background color without clearing screen

    Declaration
    public static string RenderResetBackground()
    Returns
    Type Description
    string
    | Edit this page View Source

    RenderResetColors()

    Gets a sequence that resets the console colors without clearing screen

    Declaration
    public static string RenderResetColors()
    Returns
    Type Description
    string
    | Edit this page View Source

    RenderResetForeground()

    Gets a sequence that resets the foreground color without clearing screen

    Declaration
    public static string RenderResetForeground()
    Returns
    Type Description
    string
    | Edit this page View Source

    RenderRevertBackground()

    Gets a sequence that reverts the background color without clearing screen

    Declaration
    public static string RenderRevertBackground()
    Returns
    Type Description
    string
    | Edit this page View Source

    RenderRevertColors()

    Gets a sequence that reverts the console colors without clearing screen

    Declaration
    public static string RenderRevertColors()
    Returns
    Type Description
    string
    | Edit this page View Source

    RenderRevertForeground()

    Gets a sequence that reverts the foreground color without clearing screen

    Declaration
    public static string RenderRevertForeground()
    Returns
    Type Description
    string
    | Edit this page View Source

    RenderSetConsoleColor(Color)

    Gets the console color setting sequence

    Declaration
    public static string RenderSetConsoleColor(Color ColorSequence)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    Returns
    Type Description
    string
    | Edit this page View Source

    RenderSetConsoleColor(Color, bool)

    Gets the console color setting sequence

    Declaration
    public static string RenderSetConsoleColor(Color ColorSequence, bool Background)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    bool Background

    Whether to set background or not

    Returns
    Type Description
    string
    | Edit this page View Source

    RenderSetConsoleColor(Color, bool, bool, bool)

    Gets the console color setting sequence

    Declaration
    public static string RenderSetConsoleColor(Color ColorSequence, bool Background = false, bool ForceSet = false, bool canSet = true)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    bool Background

    Whether to set background or not

    bool ForceSet

    Force set background even if background setting is disabled or if the current background color doesn't match the provided color

    bool canSet

    Can the console set this color?

    Returns
    Type Description
    string
    | Edit this page View Source

    ResetBackground()

    Resets the background color without clearing screen

    Declaration
    public static void ResetBackground()
    | Edit this page View Source

    ResetColors()

    Resets the console colors without clearing screen

    Declaration
    public static void ResetColors()
    | Edit this page View Source

    ResetForeground()

    Resets the foreground color without clearing screen

    Declaration
    public static void ResetForeground()
    | Edit this page View Source

    RevertBackground()

    Reverts the background color without clearing screen

    Declaration
    public static void RevertBackground()
    | Edit this page View Source

    RevertColors()

    Reverts the console colors without clearing screen

    Declaration
    public static void RevertColors()
    | Edit this page View Source

    RevertForeground()

    Reverts the foreground color without clearing screen

    Declaration
    public static void RevertForeground()
    | Edit this page View Source

    SetConsoleColor(Color, bool)

    Sets the console color

    Declaration
    public static void SetConsoleColor(Color ColorSequence, bool Background)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    bool Background

    Whether to set background or not

    | Edit this page View Source

    SetConsoleColor(Color, bool, bool, bool)

    Sets the console color

    Declaration
    public static void SetConsoleColor(Color ColorSequence, bool Background = false, bool ForceSet = false, bool canSet = true)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    bool Background

    Whether to set background or not

    bool ForceSet

    Force set background even if background setting is disabled or if the current background color doesn't match the provided color

    bool canSet

    Can the console set this color?

    | Edit this page View Source

    SetConsoleColorDry(Color, bool)

    Sets the console color dryly

    Declaration
    public static void SetConsoleColorDry(Color ColorSequence, bool Background)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    bool Background

    Whether to set background or not

    | Edit this page View Source

    SetConsoleColorDry(Color, bool, bool, bool)

    Sets the console color dryly

    Declaration
    public static void SetConsoleColorDry(Color ColorSequence, bool Background = false, bool ForceSet = false, bool canSet = true)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    bool Background

    Whether to set background or not

    bool ForceSet

    Force set background even if background setting is disabled or if the current background color doesn't match the provided color

    bool canSet

    Can the console set this color?

    | Edit this page View Source

    TrySetConsoleColor(Color, bool, bool, bool)

    Sets the console color

    Declaration
    public static bool TrySetConsoleColor(Color ColorSequence, bool Background = false, bool ForceSet = false, bool canSet = true)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    bool Background

    Whether to set background or not

    bool ForceSet

    Force set background even if background setting is disabled or if the current background color doesn't match the provided color

    bool canSet

    Can the console set this color?

    Returns
    Type Description
    bool

    True if successful; False if unsuccessful

    | Edit this page View Source

    TrySetConsoleColorDry(Color, bool, bool, bool)

    Sets the console color dryly

    Declaration
    public static bool TrySetConsoleColorDry(Color ColorSequence, bool Background = false, bool ForceSet = false, bool canSet = true)
    Parameters
    Type Name Description
    Color ColorSequence

    The color instance

    bool Background

    Whether to set background or not

    bool ForceSet

    Force set background even if background setting is disabled or if the current background color doesn't match the provided color

    bool canSet

    Can the console set this color?

    Returns
    Type Description
    bool

    True if successful; False if unsuccessful

    • Edit this page
    • View Source
    In this article