Skip to content

Class LegacyTextFormat

Namespace: Void.Minecraft.Components.Text.Formats
Assembly: Void.Minecraft.dll

Describes a legacy Minecraft text formatting control code.

public record LegacyTextFormat : IEquatable<LegacyTextFormat>

Inheritance

objectLegacyTextFormat

Implements

IEquatable<LegacyTextFormat>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

LegacyTextFormat(char, string)

Creates and registers a legacy text format.

public LegacyTextFormat(char code, string name)

Parameters

code char

The character following the legacy section-sign prefix.

name string

The canonical format or color name.

Remarks

Unknown codes produce a transform that resets formatting to .

Properties

Aqua

The legacy text format for aqua, identified by the b control code.

public static LegacyTextFormat Aqua { get; }

Property Value

LegacyTextFormat

Black

Gets the black color format, identified by code 0.

public static LegacyTextFormat Black { get; }

Property Value

LegacyTextFormat

Blue

Gets the blue color format, identified by code 9.

public static LegacyTextFormat Blue { get; }

Property Value

LegacyTextFormat

Bold

Gets the bold format, identified by code l.

public static LegacyTextFormat Bold { get; }

Property Value

LegacyTextFormat

Code

Gets the character following the legacy section-sign prefix.

public char Code { get; }

Property Value

char

DarkAqua

Gets the dark aqua color format, identified by code 3.

public static LegacyTextFormat DarkAqua { get; }

Property Value

LegacyTextFormat

DarkBlue

Gets the dark blue color format, identified by code 1.

public static LegacyTextFormat DarkBlue { get; }

Property Value

LegacyTextFormat

DarkGray

Gets the dark gray color format, identified by code 8.

public static LegacyTextFormat DarkGray { get; }

Property Value

LegacyTextFormat

DarkGreen

Gets the dark green color format, identified by code 2.

public static LegacyTextFormat DarkGreen { get; }

Property Value

LegacyTextFormat

DarkPurple

Gets the dark purple color format, identified by code 5.

public static LegacyTextFormat DarkPurple { get; }

Property Value

LegacyTextFormat

DarkRed

Gets the dark red color format, identified by code 4.

public static LegacyTextFormat DarkRed { get; }

Property Value

LegacyTextFormat

Gold

Gets the gold color format, identified by code 6.

public static LegacyTextFormat Gold { get; }

Property Value

LegacyTextFormat

Gray

Gets the gray color format, identified by code 7.

public static LegacyTextFormat Gray { get; }

Property Value

LegacyTextFormat

Green

Gets the green color format, identified by code a.

public static LegacyTextFormat Green { get; }

Property Value

LegacyTextFormat

Italic

Gets the italic format, identified by code o.

public static LegacyTextFormat Italic { get; }

Property Value

LegacyTextFormat

LightPurple

Gets the light purple color format, identified by code d.

public static LegacyTextFormat LightPurple { get; }

Property Value

LegacyTextFormat

Name

Gets the canonical format name.

public string Name { get; }

Property Value

string

Obfuscated

Gets the obfuscated-text format, identified by code k.

public static LegacyTextFormat Obfuscated { get; }

Property Value

LegacyTextFormat

Red

Gets the red color format, identified by code c.

public static LegacyTextFormat Red { get; }

Property Value

LegacyTextFormat

Reset

Gets the reset format, identified by code r.

public static LegacyTextFormat Reset { get; }

Property Value

LegacyTextFormat

Strikethrough

Gets the strikethrough format, identified by code m.

public static LegacyTextFormat Strikethrough { get; }

Property Value

LegacyTextFormat

Transform

Gets the operation that applies this format to existing formatting.

public Func<Formatting, Formatting> Transform { get; }

Property Value

Func<Formatting, Formatting>

Underlined

Gets the underlined format, identified by code n.

public static LegacyTextFormat Underlined { get; }

Property Value

LegacyTextFormat

White

Gets the white color format, identified by code f.

public static LegacyTextFormat White { get; }

Property Value

LegacyTextFormat

Yellow

Gets the yellow color format, identified by code e.

public static LegacyTextFormat Yellow { get; }

Property Value

LegacyTextFormat

Methods

TryFromCode(char, out LegacyTextFormat)

Finds a registered legacy format by its control-code character.

public static bool TryFromCode(char code, out LegacyTextFormat result)

Parameters

code char

The character following the section-sign prefix.

result LegacyTextFormat

The matching format when found; otherwise null.

Returns

bool

true when a matching format is registered; otherwise false.

TryFromName(ReadOnlySpan<char>, out LegacyTextFormat)

Finds a registered legacy format by its case-sensitive canonical name.

public static bool TryFromName(ReadOnlySpan<char> name, out LegacyTextFormat result)

Parameters

name ReadOnlySpan<char>

The name to match.

result LegacyTextFormat

The matching format when found; otherwise null.

Returns

bool

true when a matching format is registered; otherwise false.