Interface IColorManager
Defines the traits needed to implement ColorManager.
Namespace: Sharpie.Abstractions
Assembly: sharpie.dll
Syntax
[PublicAPI]
public interface IColorManager
Properties
CanRedefineColors
Specifies whether the terminal supports redefining colors.
Declaration
bool CanRedefineColors { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Mode
Specifies the color mode if this terminal.
Declaration
ColorMode Mode { get; }
Property Value
| Type | Description |
|---|---|
| ColorMode |
Terminal
The terminal this manager belongs to.
Declaration
ITerminal Terminal { get; }
Property Value
| Type | Description |
|---|---|
| ITerminal |
Methods
BreakdownColor(StandardColor)
Extracts the RBG attributes from a standard color.
Declaration
(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. |
BreakdownColor(short)
Extracts the RBG attributes from a color.
Declaration
(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. |
MixColors(StandardColor, StandardColor)
Creates a new color mixture from the given standard colors.
Declaration
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. |
MixColors(short, short)
Creates a new color mixture from the given colors.
Declaration
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. |
RedefineColor(StandardColor, short, short, short)
Redefines the standard color's RGB attributes (if supported).
Declaration
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. |
RedefineColor(short, short, short, short)
Redefines the color's RGB attributes (if supported).
Declaration
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. |
RemixColors(ColorMixture, StandardColor, StandardColor)
Redefines an existing color pair with the given standard colors.
Declaration
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. |
RemixColors(ColorMixture, short, short)
Redefines an existing color pair with the given colors.
Declaration
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. |
RemixDefaultColors(StandardColor, StandardColor)
Redefines the default colors of the terminal.
Declaration
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. |
RemixDefaultColors(short, short)
Redefines the default colors of the terminal.
Declaration
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. |
UnMixColors(ColorMixture)
Extracts the colors of a color mixture.
Declaration
(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. |