Class Color
Color information class
Inheritance
Namespace: Terminaux.Colors
Assembly: Terminaux.dll
Syntax
[JsonConverter(typeof(ColorSerializer))]
public class Color
Constructors
| Edit this page View SourceColor(ConsoleColor)
Makes a new instance of color class from specifier.
Declaration
public Color(ConsoleColor ColorDef)
Parameters
Type | Name | Description |
---|---|---|
ConsoleColor | ColorDef | The color taken from System.ConsoleColor |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(ConsoleColor, ColorSettings)
Makes a new instance of color class from specifier.
Declaration
public Color(ConsoleColor ColorDef, ColorSettings settings)
Parameters
Type | Name | Description |
---|---|---|
ConsoleColor | ColorDef | The color taken from System.ConsoleColor |
ColorSettings | settings | Color settings to use while building the color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(Color)
Makes a new instance of color class from specifier.
Declaration
public Color(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color from Drawing |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(int)
Makes a new instance of color class from specifier.
Declaration
public Color(int ColorNum)
Parameters
Type | Name | Description |
---|---|---|
int | ColorNum | The color number or a decimal number that specifies the RGB values up to 16777215 |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(int, int, int)
Makes a new instance of color class from specifier.
Declaration
public Color(int R, int G, int B)
Parameters
Type | Name | Description |
---|---|---|
int | R | The red level |
int | G | The green level |
int | B | The blue level |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(int, int, int, ColorSettings)
Makes a new instance of color class from specifier.
Declaration
public Color(int R, int G, int B, ColorSettings settings)
Parameters
Type | Name | Description |
---|---|---|
int | R | The red level |
int | G | The green level |
int | B | The blue level |
ColorSettings | settings | Color settings to use while building the color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(int, ColorSettings)
Makes a new instance of color class from specifier.
Declaration
public Color(int ColorNum, ColorSettings settings)
Parameters
Type | Name | Description |
---|---|---|
int | ColorNum | The color number or a decimal number that specifies the RGB values up to 16777215 |
ColorSettings | settings | Color settings to use while building the color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(string)
Makes a new instance of color class from specifier.
Declaration
public Color(string ColorSpecifier)
Parameters
Type | Name | Description |
---|---|---|
string | ColorSpecifier | A color specifier. It must be a valid number from 0-255 if using 255-colors, a VT sequence if using true color as follows: <R>;<G>;<B>, or a hexadecimal representation of a number (#AABBCC for example) |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(string, ColorSettings)
Makes a new instance of color class from specifier.
Declaration
public Color(string ColorSpecifier, ColorSettings settings)
Parameters
Type | Name | Description |
---|---|---|
string | ColorSpecifier | A color specifier. It must be a valid number from 0-255 if using 255-colors, a VT sequence if using true color as follows: <R>;<G>;<B>, or a hexadecimal representation of a number (#AABBCC for example) |
ColorSettings | settings | Color settings to use while building the color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(ConsoleColors)
Makes a new instance of color class from specifier.
Declaration
public Color(ConsoleColors ColorDef)
Parameters
Type | Name | Description |
---|---|---|
ConsoleColors | ColorDef | The color taken from ConsoleColors |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Color(ConsoleColors, ColorSettings)
Makes a new instance of color class from specifier.
Declaration
public Color(ConsoleColors ColorDef, ColorSettings settings)
Parameters
Type | Name | Description |
---|---|---|
ConsoleColors | ColorDef | The color taken from ConsoleColors |
ColorSettings | settings | Color settings to use while building the color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
Properties
| Edit this page View SourceBrightness
Determines the color brightness whether it indicates dark or light mode
Declaration
public ColorBrightness Brightness { get; }
Property Value
Type | Description |
---|---|
ColorBrightness |
ColorEnum16
The color value converted to System.ConsoleColor. Not applicable [-1] to non-4-bit colors.
Declaration
public ConsoleColor ColorEnum16 { get; }
Property Value
Type | Description |
---|---|
ConsoleColor |
ColorEnum255
The color value converted to ConsoleColors.
Declaration
public ConsoleColors ColorEnum255 { get; }
Property Value
Type | Description |
---|---|
ConsoleColors |
ColorId
The color ID for 256- and 16-color modes.
Declaration
public ConsoleColorData ColorId { get; }
Property Value
Type | Description |
---|---|
ConsoleColorData |
Empty
Empty color singleton
Declaration
public static Color Empty { get; }
Property Value
Type | Description |
---|---|
Color |
Hex
Hexadecimal representation of the color
Declaration
public string Hex { get; }
Property Value
Type | Description |
---|---|
string |
Name
Color name representation
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Opacity
Color opacity from 0 (transparent) to 255 (opaque)
Declaration
public int Opacity { get; }
Property Value
Type | Description |
---|---|
int |
PlainSequence
Either 0-255, or <R>;<G>;<B>, depending on the settings.
Declaration
public string PlainSequence { get; }
Property Value
Type | Description |
---|---|
string |
PlainSequenceOriginal
Either 0-255, or <R>;<G>;<B> in its original form.
Declaration
public string PlainSequenceOriginal { get; }
Property Value
Type | Description |
---|---|
string |
PlainSequenceTrueColor
<R>;<G>;<B>
Declaration
public string PlainSequenceTrueColor { get; }
Property Value
Type | Description |
---|---|
string |
RGB
An instance of RGB
Declaration
public RedGreenBlue RGB { get; }
Property Value
Type | Description |
---|---|
RedGreenBlue |
Type
Color type
Declaration
public ColorType Type { get; }
Property Value
Type | Description |
---|---|
ColorType |
VTSequenceBackground
Parsable VT sequence (Background)
Declaration
public string VTSequenceBackground { get; }
Property Value
Type | Description |
---|---|
string |
VTSequenceBackgroundOriginal
Parsable VT sequence (Background, original)
Declaration
public string VTSequenceBackgroundOriginal { get; }
Property Value
Type | Description |
---|---|
string |
VTSequenceBackgroundTrueColor
Parsable VT sequence (Background, true color)
Declaration
public string VTSequenceBackgroundTrueColor { get; }
Property Value
Type | Description |
---|---|
string |
VTSequenceForeground
Parsable VT sequence (Foreground)
Declaration
public string VTSequenceForeground { get; }
Property Value
Type | Description |
---|---|
string |
VTSequenceForegroundOriginal
Parsable VT sequence (Foreground, original)
Declaration
public string VTSequenceForegroundOriginal { get; }
Property Value
Type | Description |
---|---|
string |
VTSequenceForegroundTrueColor
Parsable VT sequence (Foreground, true color)
Declaration
public string VTSequenceForegroundTrueColor { get; }
Property Value
Type | Description |
---|---|
string |
Methods
| Edit this page View SourceEquals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
Equals(Color)
Checks to see if this instance of the color is equal to another instance of the color
Declaration
public bool Equals(Color other)
Parameters
Type | Name | Description |
---|---|---|
Color | other | Another instance of the color to compare with this color |
Returns
Type | Description |
---|---|
bool | True if both the colors match; otherwise, false. |
Equals(Color, Color)
Checks to see if the first instance of the color is equal to another instance of the color
Declaration
public bool Equals(Color other, Color other2)
Parameters
Type | Name | Description |
---|---|---|
Color | other | Another instance of the color to compare with another |
Color | other2 | Another instance of the color to compare with another |
Returns
Type | Description |
---|---|
bool | True if both the colors match; otherwise, false. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
ToString()
Either 0-255, or <R>;<G>;<B>, depending on the usage of the terminal palette.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Operators
| Edit this page View Sourceoperator ==(Color, Color)
Declaration
public static bool operator ==(Color a, Color b)
Parameters
Type | Name | Description |
---|---|---|
Color | a | |
Color | b |
Returns
Type | Description |
---|---|
bool |
implicit operator Color(ConsoleColor)
Makes a new instance of color class from specifier.
Declaration
public static implicit operator Color(ConsoleColor ColorDef)
Parameters
Type | Name | Description |
---|---|---|
ConsoleColor | ColorDef | The color taken from System.ConsoleColor |
Returns
Type | Description |
---|---|
Color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
implicit operator Color(Color)
Makes a new instance of color class from specifier.
Declaration
public static implicit operator Color(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color from Drawing |
Returns
Type | Description |
---|---|
Color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
implicit operator Color(int)
Makes a new instance of color class from specifier.
Declaration
public static implicit operator Color(int ColorNum)
Parameters
Type | Name | Description |
---|---|---|
int | ColorNum | The color number |
Returns
Type | Description |
---|---|
Color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
implicit operator Color(string)
Makes a new instance of color class from specifier.
Declaration
public static implicit operator Color(string ColorSpecifier)
Parameters
Type | Name | Description |
---|---|---|
string | ColorSpecifier | A color specifier. It must be a valid number from 0-255 if using 255-colors, a VT sequence if using true color as follows: <R>;<G>;<B>, or a hexadecimal representation of a number (#AABBCC for example) |
Returns
Type | Description |
---|---|
Color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
implicit operator Color(ConsoleColors)
Makes a new instance of color class from specifier.
Declaration
public static implicit operator Color(ConsoleColors ColorDef)
Parameters
Type | Name | Description |
---|---|---|
ConsoleColors | ColorDef | The color taken from ConsoleColors |
Returns
Type | Description |
---|---|
Color |
Exceptions
Type | Condition |
---|---|
TerminauxException |
operator !=(Color, Color)
Declaration
public static bool operator !=(Color a, Color b)
Parameters
Type | Name | Description |
---|---|---|
Color | a | |
Color | b |
Returns
Type | Description |
---|---|
bool |