Search Results for

    Class ConsoleColoring

    Console coloring extensions

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


    Properties

    AllowBackground

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

    Property Value
    bool
    Declaration
    public static bool AllowBackground { get; set; }

    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.

    Property Value
    bool
    Declaration
    public static bool ConsoleSupportsTrueColor { get; set; }

    CurrentBackgroundColor

    Current background color

    Property Value
    Color
    Declaration
    public static Color CurrentBackgroundColor { get; }

    CurrentForegroundColor

    Current foreground color

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


    Methods

    DetermineTrueColorFromUser()

    Asks the user to decide whether the terminal supports true color

    Declaration
    public static void DetermineTrueColorFromUser()

    GetGray(ColorContrastType)

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

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

    Contrast type

    LoadBack()

    Loads the background

    Declaration
    public static void LoadBack()

    LoadBack(Color, bool)

    Loads the background

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

    Color sequence used to load background

    Force bool

    Force set background even if background setting is disabled

    LoadBackDry()

    Loads the background dryly

    Declaration
    public static void LoadBackDry()

    LoadBackDry(Color, bool)

    Loads the background dryly

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

    Color sequence used to load background

    Force bool

    Force set background even if background setting is disabled

    RenderResetBackground()

    Gets a sequence that resets the background color without clearing screen

    Returns
    string
    Declaration
    public static string RenderResetBackground()

    RenderResetColors()

    Gets a sequence that resets the console colors without clearing screen

    Returns
    string
    Declaration
    public static string RenderResetColors()

    RenderResetForeground()

    Gets a sequence that resets the foreground color without clearing screen

    Returns
    string
    Declaration
    public static string RenderResetForeground()

    RenderRevertBackground()

    Gets a sequence that reverts the background color without clearing screen

    Returns
    string
    Declaration
    public static string RenderRevertBackground()

    RenderRevertColors()

    Gets a sequence that reverts the console colors without clearing screen

    Returns
    string
    Declaration
    public static string RenderRevertColors()

    RenderRevertForeground()

    Gets a sequence that reverts the foreground color without clearing screen

    Returns
    string
    Declaration
    public static string RenderRevertForeground()

    RenderSetConsoleColor(Color)

    Gets the console color setting sequence

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

    The color instance

    RenderSetConsoleColor(Color, bool)

    Gets the console color setting sequence

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

    The color instance

    Background bool

    Whether to set background or not

    RenderSetConsoleColor(Color, bool, bool, bool)

    Gets the console color setting sequence

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

    The color instance

    Background bool

    Whether to set background or not

    ForceSet bool

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

    canSet bool

    Can the console set this color?

    ResetBackground()

    Resets the background color without clearing screen

    Declaration
    public static void ResetBackground()

    ResetColors()

    Resets the console colors without clearing screen

    Declaration
    public static void ResetColors()

    ResetForeground()

    Resets the foreground color without clearing screen

    Declaration
    public static void ResetForeground()

    RevertBackground()

    Reverts the background color without clearing screen

    Declaration
    public static void RevertBackground()

    RevertColors()

    Reverts the console colors without clearing screen

    Declaration
    public static void RevertColors()

    RevertForeground()

    Reverts the foreground color without clearing screen

    Declaration
    public static void RevertForeground()

    SetConsoleColor(Color, bool)

    Sets the console color

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

    The color instance

    Background bool

    Whether to set background or not

    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
    Name Type Description
    ColorSequence Color

    The color instance

    Background bool

    Whether to set background or not

    ForceSet bool

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

    canSet bool

    Can the console set this color?

    SetConsoleColorDry(Color, bool)

    Sets the console color dryly

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

    The color instance

    Background bool

    Whether to set background or not

    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
    Name Type Description
    ColorSequence Color

    The color instance

    Background bool

    Whether to set background or not

    ForceSet bool

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

    canSet bool

    Can the console set this color?

    TrySetConsoleColor(Color, bool, bool, bool)

    Sets the console color

    Returns
    bool

    True if successful; False if unsuccessful

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

    The color instance

    Background bool

    Whether to set background or not

    ForceSet bool

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

    canSet bool

    Can the console set this color?

    TrySetConsoleColorDry(Color, bool, bool, bool)

    Sets the console color dryly

    Returns
    bool

    True if successful; False if unsuccessful

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

    The color instance

    Background bool

    Whether to set background or not

    ForceSet bool

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

    canSet bool

    Can the console set this color?

    VTSequenceBackground(Color)

    Parsable VT sequence (Background)

    Returns
    string
    Declaration
    public static string VTSequenceBackground(this Color color)
    Parameters
    Name Type Description
    color Color

    VTSequenceBackgroundOriginal(Color)

    Parsable VT sequence (Background)

    Returns
    string
    Declaration
    public static string VTSequenceBackgroundOriginal(this Color color)
    Parameters
    Name Type Description
    color Color

    VTSequenceBackgroundTrueColor(Color)

    Parsable VT sequence (Background, true color)

    Returns
    string
    Declaration
    public static string VTSequenceBackgroundTrueColor(this Color color)
    Parameters
    Name Type Description
    color Color

    VTSequenceForeground(Color)

    Parsable VT sequence (Foreground)

    Returns
    string
    Declaration
    public static string VTSequenceForeground(this Color color)
    Parameters
    Name Type Description
    color Color

    VTSequenceForegroundOriginal(Color)

    Parsable VT sequence (Foreground)

    Returns
    string
    Declaration
    public static string VTSequenceForegroundOriginal(this Color color)
    Parameters
    Name Type Description
    color Color

    VTSequenceForegroundTrueColor(Color)

    Parsable VT sequence (Foreground, true color)

    Returns
    string
    Declaration
    public static string VTSequenceForegroundTrueColor(this Color color)
    Parameters
    Name Type Description
    color Color
    Show / Hide Table of Contents

    Table of contents



      About

      Copyright © 2014-2026 Aptivi

      Find us

    •  
    •  
    •  
    •  
    •  
    •  
    • Social media

    •  
    •  
    •  
    •