TextColor
Namespace Mc.Scripting.Text · Kind struct (readonly)
public readonly struct TextColor : IEquatable<TextColor>A named or RGB text colour.
Properties
Section titled “Properties”| Member | Description |
|---|---|
bool IsSet { get; } |
Whether a colour is set. |
int Rgb { get; } |
The colour as 0xRRGGBB (0 when unset). |
static TextColor Aqua { get; } |
Aqua (&b). |
static TextColor Black { get; } |
Black (&0). |
static TextColor Blue { get; } |
Blue (&9). |
static TextColor DarkAqua { get; } |
Dark aqua (&3). |
static TextColor DarkBlue { get; } |
Dark blue (&1). |
static TextColor DarkGray { get; } |
Dark gray (&8). |
static TextColor DarkGreen { get; } |
Dark green (&2). |
static TextColor DarkPurple { get; } |
Dark purple (&5). |
static TextColor DarkRed { get; } |
Dark red (&4). |
static TextColor Gold { get; } |
Gold (&6). |
static TextColor Gray { get; } |
Gray (&7). |
static TextColor Green { get; } |
Green (&a). |
static TextColor LightPurple { get; } |
Light purple (&d). |
static TextColor None { get; } |
No colour (inherit). |
static TextColor Red { get; } |
Red (&c). |
static TextColor White { get; } |
White (&f). |
static TextColor Yellow { get; } |
Yellow (&e). |
public bool IsSet { get; }Whether a colour is set.
public int Rgb { get; }The colour as 0xRRGGBB (0 when unset).
public static TextColor Aqua { get; }Aqua (&b).
public static TextColor Black { get; }Black (&0).
public static TextColor Blue { get; }Blue (&9).
DarkAqua
Section titled “DarkAqua”public static TextColor DarkAqua { get; }Dark aqua (&3).
DarkBlue
Section titled “DarkBlue”public static TextColor DarkBlue { get; }Dark blue (&1).
DarkGray
Section titled “DarkGray”public static TextColor DarkGray { get; }Dark gray (&8).
DarkGreen
Section titled “DarkGreen”public static TextColor DarkGreen { get; }Dark green (&2).
DarkPurple
Section titled “DarkPurple”public static TextColor DarkPurple { get; }Dark purple (&5).
DarkRed
Section titled “DarkRed”public static TextColor DarkRed { get; }Dark red (&4).
public static TextColor Gold { get; }Gold (&6).
public static TextColor Gray { get; }Gray (&7).
public static TextColor Green { get; }Green (&a).
LightPurple
Section titled “LightPurple”public static TextColor LightPurple { get; }Light purple (&d).
public static TextColor None { get; }No colour (inherit).
public static TextColor Red { get; }Red (&c).
public static TextColor White { get; }White (&f).
Yellow
Section titled “Yellow”public static TextColor Yellow { get; }Yellow (&e).
Methods
Section titled “Methods”| Member | Description |
|---|---|
bool Equals(TextColor other) |
|
override bool Equals(object? obj) |
|
override int GetHashCode() |
|
override string ToString() |
The vanilla serialisation: a colour name for the 16 named colours, “#RRGGBB” otherwise. |
static TextColor FromRgb(int rgb) |
A custom 24-bit colour. |
static TextColor Parse(string text) |
Parses a vanilla colour name (“red”) or “#RRGGBB”. |
Equals
Section titled “Equals”public bool Equals(TextColor other)Parameters
| Name | Type | Description |
|---|---|---|
other |
TextColor |
Returns bool
Equals
Section titled “Equals”public override bool Equals(object? obj)Parameters
| Name | Type | Description |
|---|---|---|
obj |
object? |
Returns bool
GetHashCode
Section titled “GetHashCode”public override int GetHashCode()Returns int
ToString
Section titled “ToString”public override string ToString()The vanilla serialisation: a colour name for the 16 named colours, “#RRGGBB” otherwise.
Returns string
FromRgb
Section titled “FromRgb”public static TextColor FromRgb(int rgb)A custom 24-bit colour.
Parameters
| Name | Type | Description |
|---|---|---|
rgb |
int |
0xRRGGBB. |
Returns TextColor
public static TextColor Parse(string text)Parses a vanilla colour name (“red”) or “#RRGGBB”.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
Returns TextColor: The colour, or TextColor.None when the text is not a colour.
Operators
Section titled “Operators”| Member | Description |
|---|---|
static bool operator !=(TextColor a, TextColor b) |
Inequality. |
static bool operator ==(TextColor a, TextColor b) |
Equality. |
operator !=
Section titled “operator !=”public static bool operator !=(TextColor a, TextColor b)Inequality.
Parameters
| Name | Type | Description |
|---|---|---|
a |
TextColor |
|
b |
TextColor |
Returns bool
operator ==
Section titled “operator ==”public static bool operator ==(TextColor a, TextColor b)Equality.
Parameters
| Name | Type | Description |
|---|---|---|
a |
TextColor |
|
b |
TextColor |
Returns bool