ChatColor is a class for defining color codes.

Hierarchy

  • ChatColor

Constructors

  • Class ChatColor Constructor.

    Parameters

    • code: string

      The color code as a string.

    • Optional color: number

      The color code as a hexadecimal number. Can be undefined.

    Returns ChatColor

Properties

b?: any
code: any
color?: any
g?: any
r?: any
ALL_COLORS: ChatColor[]

All available color codes excluding the formatting codes.

AQUA: ChatColor

Aqua color code. (b)

BLACK: ChatColor

Black color code. (0)

BLUE: ChatColor

Blue color code. (9)

BOLD: ChatColor

Bold color code. (l)

DARK_AQUA: ChatColor

Dark aqua color code. (3)

DARK_BLUE: ChatColor

Dark blue color code. (1)

DARK_GRAY: ChatColor

Dark gray color code. (8)

DARK_GREEN: ChatColor

Dark green color code. (2)

DARK_PURPLE: ChatColor

Dark purple color code. (5)

DARK_RED: ChatColor

Dark red color code. (4)

GOLD: ChatColor

Gold color code. (6)

GRAY: ChatColor

Gray color code. (7)

GREEN: ChatColor

Green color code. (a)

ITALIC: ChatColor

Italic color code. (o)

LIGHT_PURPLE: ChatColor

Light purple color code. (d)

MATERIAL_AMETHYST: ChatColor

Material amethyst color code. (u)

MATERIAL_COPPER: ChatColor

Material copper color code. (n)

MATERIAL_DIAMOND: ChatColor

Material diamond color code. (s)

MATERIAL_EMERALD: ChatColor

Material emerald color code. (q)

MATERIAL_GOLD: ChatColor

Material gold color code. (p)

MATERIAL_IRON: ChatColor

Material iron color code. (i)

MATERIAL_LAPIS: ChatColor

Material lapis color code. (t)

MATERIAL_NETHERITE: ChatColor

Material netherite color code. (j)

MATERIAL_QUARTZ: ChatColor

Material quartz color code. (h)

MATERIAL_REDSTONE: ChatColor

Material redstone color code. (m)

MINECOIN_GOLD: ChatColor

MineCoin gold color code. (g)

OBFUSCATED: ChatColor

Obfuscated color code. (k)

PREFIX: any

PREFIX is the section sign (ยง) used in Minecraft color codes.

Red color code. (c)

RESET: ChatColor

Reset color code. (r)

VALUES: ChatColor[]

All available color codes.

WHITE: ChatColor

White color code. (f)

YELLOW: ChatColor

Yellow color code. (e)

Methods

  • Retrieves the blue value of a color.

    Returns undefined | number

    The blue value of the color.

  • Retrieves the format code associated with the chat color.

    Returns string

    The format code of the chat color.

  • Retrieves the green value of the current color.

    Returns undefined | number

    The green value of the color, or undefined if it is not set.

  • Retrieve the value of the red component.

    Returns undefined | number

    The value of the red component, or undefined if it is not set.

  • Returns the hexadecimal string representation of the color code

    Returns undefined | string

    The hexadecimal representation of the color.

  • Returns the color code of the ChatColor instance.

    Returns undefined | number

    The color code of this ChatColor instance.

  • Returns the string representation of the ChatColor instance, which includes the PREFIX followed by the color code.

    Returns string

    A string representing the ChatColor instance

  • Finds the closest ChatColor code for the given RGB values

    Parameters

    • r: number

      Red part of the color.

    • g: number

      Green part of the color.

    • b: number

      Blue part of the color.

    Returns ChatColor

    The closest ChatColor for the given RGB values.

  • Removes color codes from the specified string

    Parameters

    • str: string

      The string from which color codes will be removed.

    Returns string

    The string cleared from color codes.