Skip to content

TextColor

Namespace Mc.Scripting.Text · Kind struct (readonly)

public readonly struct TextColor : IEquatable<TextColor>

A named or RGB text colour.

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).

public static TextColor DarkAqua { get; }

Dark aqua (&3).

public static TextColor DarkBlue { get; }

Dark blue (&1).

public static TextColor DarkGray { get; }

Dark gray (&8).

public static TextColor DarkGreen { get; }

Dark green (&2).

public static TextColor DarkPurple { get; }

Dark purple (&5).

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).

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).

public static TextColor Yellow { get; }

Yellow (&e).

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”.
public bool Equals(TextColor other)

Parameters

Name Type Description
other TextColor

Returns bool

public override bool Equals(object? obj)

Parameters

Name Type Description
obj object?

Returns bool

public override int GetHashCode()

Returns int

public override string ToString()

The vanilla serialisation: a colour name for the 16 named colours, “#RRGGBB” otherwise.

Returns string

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.

Member Description
static bool operator !=(TextColor a, TextColor b) Inequality.
static bool operator ==(TextColor a, TextColor b) Equality.
public static bool operator !=(TextColor a, TextColor b)

Inequality.

Parameters

Name Type Description
a TextColor
b TextColor

Returns bool

public static bool operator ==(TextColor a, TextColor b)

Equality.

Parameters

Name Type Description
a TextColor
b TextColor

Returns bool