Sharpie
Search Results for

    Show / Hide Table of Contents
    • Sharpie
      • Canvas
      • Canvas.CheckGlyphStyle
      • Canvas.FillStyle
      • Canvas.GlyphSize
      • Canvas.GradientGlyphStyle
      • Canvas.LineStyle
      • Canvas.Orientation
      • Canvas.ShadeGlyphStyle
      • Canvas.TriangleGlyphStyle
      • CaretMode
      • ClearStrategy
      • ColorManager
      • ColorMixture
      • ColorMode
      • ControlCharacter
      • CursesException
      • CursesInitializationException
      • CursesOperationException
      • CursesSynchronizationException
      • DelegateEvent
      • Event
      • EventPump
      • EventType
      • Key
      • KeyEvent
      • KeySequenceResolver
      • ModifierKey
      • MouseActionEvent
      • MouseButton
      • MouseButtonState
      • MouseMoveEvent
      • Pad
      • ReplaceStrategy
      • ResolveEscapeSequenceFunc
      • Screen
      • SoftLabelKeyAlignment
      • SoftLabelKeyManager
      • SoftLabelKeyMode
      • StandardColor
      • StartEvent
      • StopEvent
      • Style
      • StyledText
      • SubPad
      • SubWindow
      • Surface
      • Terminal
      • TerminalOptions
      • TerminalResizeEvent
      • TerminalSurface
      • VideoAttribute
      • Window
    • Sharpie.Abstractions
      • IAsciiFont
      • IColorManager
      • ICursesBackend
      • ICursesBackend.ripoffline_callback
      • IDrawSurface
      • IDrawable
      • IEventPump
      • IInterval
      • IPad
      • IScreen
      • ISoftLabelKeyManager
      • ISubPad
      • ISubWindow
      • ISurface
      • ITerminal
      • ITerminalSurface
      • IWindow
    • Sharpie.Backend
      • ComplexChar
      • CursesBackend
      • CursesBackendFlavor
      • CursesBackendType
      • CursesCharEvent
      • CursesEvent
      • CursesKeyEvent
      • CursesMouseEvent
      • CursesMouseState
      • CursesResizeEvent
      • NCursesKeyCode
      • PdCursesKeyCode
    • Sharpie.Font
      • AsciiFont
      • AsciiFontLayout
      • DosCp866AsciiFont
      • FigletFont

    Class ColorManager

    Exposes functionality to manage colors.

    Inheritance
    object
    ColorManager
    Implements
    IColorManager
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Sharpie
    Assembly: sharpie.dll
    Syntax
    [PublicAPI]
    public sealed class ColorManager : IColorManager

    Properties

    CanRedefineColors

    Specifies whether the terminal supports redefining colors.

    Declaration
    public bool CanRedefineColors { get; }
    Property Value
    Type Description
    bool

    Mode

    Specifies the color mode if this terminal.

    Declaration
    public ColorMode Mode { get; }
    Property Value
    Type Description
    ColorMode

    Terminal

    The terminal this manager belongs to.

    Declaration
    public Terminal Terminal { get; }
    Property Value
    Type Description
    Terminal

    Methods

    BreakdownColor(StandardColor)

    Extracts the RBG attributes from a standard color.

    Declaration
    public (short red, short green, short blue) BreakdownColor(StandardColor color)
    Parameters
    Type Name Description
    StandardColor color

    The color to get the RGB from.

    Returns
    Type Description
    (short red, short green, short blue)
    Remarks

    Before calling this function make sure that terminal supports this functionality by checking CanRedefineColors. This operation is not thread safe.

    Exceptions
    Type Condition
    NotSupportedException

    If the terminal does not support redefining colors.

    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    BreakdownColor(short)

    Extracts the RBG attributes from a color.

    Declaration
    public (short red, short green, short blue) BreakdownColor(short color)
    Parameters
    Type Name Description
    short color

    The color to get the RGB from.

    Returns
    Type Description
    (short red, short green, short blue)
    Remarks

    Before calling this function make sure that terminal supports this functionality by checking CanRedefineColors. This operation is not thread safe.

    Exceptions
    Type Condition
    NotSupportedException

    If the terminal does not support redefining colors.

    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    MixColors(StandardColor, StandardColor)

    Creates a new color mixture from the given standard colors.

    Declaration
    public ColorMixture MixColors(StandardColor fgColor, StandardColor bgColor)
    Parameters
    Type Name Description
    StandardColor fgColor

    The foreground color.

    StandardColor bgColor

    The background color.

    Returns
    Type Description
    ColorMixture

    A new color mixture.

    Remarks

    This operation is not thread safe.

    Exceptions
    Type Condition
    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    MixColors(short, short)

    Creates a new color mixture from the given colors.

    Declaration
    public ColorMixture MixColors(short fgColor, short bgColor)
    Parameters
    Type Name Description
    short fgColor

    The foreground color.

    short bgColor

    The background color.

    Returns
    Type Description
    ColorMixture

    A new color mixture.

    Remarks

    This operation is not thread safe.

    Exceptions
    Type Condition
    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    RedefineColor(StandardColor, short, short, short)

    Redefines the standard color's RGB attributes (if supported).

    Declaration
    public void RedefineColor(StandardColor color, short red, short green, short blue)
    Parameters
    Type Name Description
    StandardColor color

    The color to redefine.

    short red

    The value of red (0-1000).

    short green

    The value of green (0-1000).

    short blue

    The value of blue (0-1000).

    Remarks

    Before calling this function make sure that terminal supports this functionality by checking CanRedefineColors. This operation is not thread safe.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    If any of the three components is greater than 1000.

    NotSupportedException

    If the terminal does not support redefining colors.

    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    RedefineColor(short, short, short, short)

    Redefines the color's RGB attributes (if supported).

    Declaration
    public void RedefineColor(short color, short red, short green, short blue)
    Parameters
    Type Name Description
    short color

    The color to redefine.

    short red

    The value of red (0-1000).

    short green

    The value of green (0-1000).

    short blue

    The value of blue (0-1000).

    Remarks

    Before calling this function make sure that terminal supports this functionality by checking CanRedefineColors. This operation is not thread safe.

    Exceptions
    Type Condition
    NotSupportedException

    If the terminal does not support redefining colors.

    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    RemixColors(ColorMixture, StandardColor, StandardColor)

    Redefines an existing color pair with the given standard colors.

    Declaration
    public void RemixColors(ColorMixture mixture, StandardColor fgColor, StandardColor bgColor)
    Parameters
    Type Name Description
    ColorMixture mixture

    The color mixture to redefine.

    StandardColor fgColor

    The foreground color.

    StandardColor bgColor

    The background color.

    Remarks

    This operation is not thread safe.

    Exceptions
    Type Condition
    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    RemixColors(ColorMixture, short, short)

    Redefines an existing color pair with the given colors.

    Declaration
    public void RemixColors(ColorMixture mixture, short fgColor, short bgColor)
    Parameters
    Type Name Description
    ColorMixture mixture

    The color mixture to redefine.

    short fgColor

    The foreground color.

    short bgColor

    The background color.

    Remarks

    This operation is not thread safe.

    Exceptions
    Type Condition
    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    RemixDefaultColors(StandardColor, StandardColor)

    Redefines the default colors of the terminal.

    Declaration
    public void RemixDefaultColors(StandardColor fgColor, StandardColor bgColor)
    Parameters
    Type Name Description
    StandardColor fgColor

    The foreground color.

    StandardColor bgColor

    The background color.

    Remarks

    This operation is not thread safe.

    Exceptions
    Type Condition
    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    RemixDefaultColors(short, short)

    Redefines the default colors of the terminal.

    Declaration
    public void RemixDefaultColors(short fgColor, short bgColor)
    Parameters
    Type Name Description
    short fgColor

    The foreground color.

    short bgColor

    The background color.

    Remarks

    This operation is not thread safe.

    Exceptions
    Type Condition
    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    UnMixColors(ColorMixture)

    Extracts the colors of a color mixture.

    Declaration
    public (short fgColor, short bgColor) UnMixColors(ColorMixture mixture)
    Parameters
    Type Name Description
    ColorMixture mixture

    The color mixture to get the colors from.

    Returns
    Type Description
    (short fgColor, short bgColor)
    Remarks

    This operation is not thread safe.

    Exceptions
    Type Condition
    NotSupportedException

    If the terminal does not support redefining colors.

    CursesSynchronizationException

    Thrown if this operation was expected to run on the main thread/context but wasn't.

    CursesOperationException

    A Curses error occured.

    Implements

    IColorManager
    In this article
    Back to top Generated by DocFX