Class ParsingTools
Tools to parse RGB specifiers for general use
Inheritance
Namespace: Terminaux.Colors.Models.Parsing
Assembly: Terminaux.dll
Syntax
public static class ParsingTools
Methods
| Edit this page View SourceIsSpecifierAndValueValid(string)
Does the string specifier represent a valid model-agnostic specifier and contain valid values?
Declaration
public static bool IsSpecifierAndValueValid(string specifier)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier that represents a valid model-agnostic specifier and contains valid values |
Returns
Type | Description |
---|---|
bool | True if the specifier is valid; false otherwise. |
IsSpecifierAndValueValidRgbHash(string)
Does the string specifier represent a valid RGB hash (#RGB or #RRGGBB) as in HTML?
Declaration
public static bool IsSpecifierAndValueValidRgbHash(string specifier)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier that represents a valid RGB hash (#RGB or #RRGGBB) as in HTML |
Returns
Type | Description |
---|---|
bool | True if the specifier is valid; false otherwise. |
IsSpecifierConsoleColors(string)
Does the string specifier represent either a color name taken from ConsoleColors, a color number from 0 to 255, or a color code?
Declaration
public static bool IsSpecifierConsoleColors(string specifier)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier that represents either a color name taken from ConsoleColors, a color number from 0 to 255, or a color code |
Returns
Type | Description |
---|---|
bool | True if the specifier is valid; false otherwise. |
IsSpecifierValid(string)
Does the string specifier represent a valid model-agnostic specifier?
Declaration
public static bool IsSpecifierValid(string specifier)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier that represents a valid model-agnostic specifier |
Returns
Type | Description |
---|---|
bool | True if the specifier is valid; false otherwise. |
IsSpecifierValidRgbHash(string)
Does the string specifier represent a valid RGB hash (#RGB or #RRGGBB) as in HTML?
Declaration
public static bool IsSpecifierValidRgbHash(string specifier)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier that represents a valid RGB hash (#RGB or #RRGGBB) as in HTML |
Returns
Type | Description |
---|---|
bool | True if the specifier is valid; false otherwise. |
ParseSpecifier(string, ColorSettings?)
Parses the specifier and returns an instance of RedGreenBlue
Declaration
public static RedGreenBlue ParseSpecifier(string specifier, ColorSettings? settings = null)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier of RGB |
ColorSettings | settings | Settings to use. Use null for global settings |
Returns
Type | Description |
---|---|
RedGreenBlue | An instance of RedGreenBlue |
Exceptions
Type | Condition |
---|---|
TerminauxException |
ParseSpecifierRgbHash(string, ColorSettings?)
Parses the hex representation of RGB and returns an instance of RedGreenBlue
Declaration
public static RedGreenBlue ParseSpecifierRgbHash(string specifier, ColorSettings? settings = null)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier of RGB in hex representation |
ColorSettings | settings | Settings to use. Use null for global settings |
Returns
Type | Description |
---|---|
RedGreenBlue | An instance of RedGreenBlue |
Exceptions
Type | Condition |
---|---|
TerminauxException |
ParseSpecifierRgbName(string, ColorSettings?)
Parses the specifier that holds the color name and returns an instance of RedGreenBlue
Declaration
public static RedGreenBlue ParseSpecifierRgbName(string specifier, ColorSettings? settings = null)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Color name defined in ConsoleColors |
ColorSettings | settings | Settings to use. Use null for global settings |
Returns
Type | Description |
---|---|
RedGreenBlue | An instance of RedGreenBlue |
Exceptions
Type | Condition |
---|---|
TerminauxException |
TryParseSpecifier(string, out RedGreenBlue?)
Parses the specifier and returns an instance of RedGreenBlue
Declaration
public static bool TryParseSpecifier(string specifier, out RedGreenBlue? rgb)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier of RGB |
RedGreenBlue | rgb | Output for the RGB component for 256- and 16-color modes |
Returns
Type | Description |
---|---|
bool | An instance of RedGreenBlue |
Exceptions
Type | Condition |
---|---|
TerminauxException |
TryParseSpecifierRgbHash(string, out RedGreenBlue?)
Parses the hex representation of RGB and returns an instance of RedGreenBlue
Declaration
public static bool TryParseSpecifierRgbHash(string specifier, out RedGreenBlue? output)
Parameters
Type | Name | Description |
---|---|---|
string | specifier | Specifier of RGB in hex representation |
RedGreenBlue | output | Output for the RGB component |
Returns
Type | Description |
---|---|
bool | An instance of RedGreenBlue |
Exceptions
Type | Condition |
---|---|
TerminauxException |