Class MinecraftColor<R, G, B>

Type Parameters

  • R extends ColorObj["red"]

    Red color amount.

  • G extends ColorObj["blue"]

    Green color amount.

  • B extends ColorObj["green"]

    Blue color amount.

Hierarchy

  • MinecraftColor

Constructors

  • Returns a new MinecraftColor with the given RGB values.

    Type Parameters

    • R extends number

    • G extends number

    • B extends number

    Parameters

    • values: {
          blue: B;
          green: G;
          red: R;
      }
      • blue: B
      • green: G
      • red: R

    Returns MinecraftColor<R, G, B>

Properties

blue: B
green: G
red: R
colorMap: {
    0: "black";
    1: "dark_blue";
    2: "dark_green";
    3: "dark_aqua";
    4: "dark_red";
    5: "dark_purple";
    6: "gold";
    7: "gray";
    8: "dark_gray";
    9: "blue";
    a: "green";
    b: "aqua";
    c: "red";
    d: "light_purple";
    e: "yellow";
    f: "white";
} = ...

Object map containing the Minecraft color codes and their corresponding names.

Type declaration

  • Readonly 0: "black"
  • Readonly 1: "dark_blue"
  • Readonly 2: "dark_green"
  • Readonly 3: "dark_aqua"
  • Readonly 4: "dark_red"
  • Readonly 5: "dark_purple"
  • Readonly 6: "gold"
  • Readonly 7: "gray"
  • Readonly 8: "dark_gray"
  • Readonly 9: "blue"
  • Readonly a: "green"
  • Readonly b: "aqua"
  • Readonly c: "red"
  • Readonly d: "light_purple"
  • Readonly e: "yellow"
  • Readonly f: "white"
colors: {
    aqua: readonly ["55", "FF", "FF"];
    black: readonly ["00", "00", "00"];
    blue: readonly ["55", "55", "FF"];
    dark_aqua: readonly ["00", "AA", "AA"];
    dark_blue: readonly ["00", "00", "AA"];
    dark_gray: readonly ["55", "55", "55"];
    dark_green: readonly ["00", "AA", "00"];
    dark_purple: readonly ["AA", "00", "AA"];
    dark_red: readonly ["AA", "00", "00"];
    gold: readonly ["FF", "AA", "00"];
    gray: readonly ["AA", "AA", "AA"];
    green: readonly ["55", "FF", "55"];
    light_purple: readonly ["FF", "55", "FF"];
    red: readonly ["FF", "55", "55"];
    white: readonly ["FF", "FF", "FF"];
    yellow: readonly ["FF", "FF", "55"];
} = ...

Object map containing the Minecraft color codes and their corresponding hex values.

Type declaration

  • Readonly aqua: readonly ["55", "FF", "FF"]
  • Readonly black: readonly ["00", "00", "00"]
  • Readonly blue: readonly ["55", "55", "FF"]
  • Readonly dark_aqua: readonly ["00", "AA", "AA"]
  • Readonly dark_blue: readonly ["00", "00", "AA"]
  • Readonly dark_gray: readonly ["55", "55", "55"]
  • Readonly dark_green: readonly ["00", "AA", "00"]
  • Readonly dark_purple: readonly ["AA", "00", "AA"]
  • Readonly dark_red: readonly ["AA", "00", "00"]
  • Readonly gold: readonly ["FF", "AA", "00"]
  • Readonly gray: readonly ["AA", "AA", "AA"]
  • Readonly green: readonly ["55", "FF", "55"]
  • Readonly light_purple: readonly ["FF", "55", "FF"]
  • Readonly red: readonly ["FF", "55", "55"]
  • Readonly white: readonly ["FF", "FF", "FF"]
  • Readonly yellow: readonly ["FF", "FF", "55"]

Methods

  • Stringify the color into a readable format.

    Returns

    Hex string representation of the color.

    Type Parameters

    • IsSpigotMC extends boolean = false

    • CSymbol extends string = "&"

    Parameters

    • spigotmc: IsSpigotMC

      Should turn into a SpigotMC compatible color code.

    • codeSymbol: CSymbol = ...

      Character symbol to use for SpigotMC if true.

    Returns IsSpigotMC extends true ? `&x${CSymbol}${number}${CSymbol}${number}${CSymbol}${number}${CSymbol}${number}${CSymbol}${number}${CSymbol}${number}` : `#${string}`

  • Turn vanilla Minecraft color code into a MinecraftColor object.

    Returns

    A new MinecraftColor.

    Type Parameters

    • T extends "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "0" | "a" | "b" | "c" | "d" | "e" | "f" | `#${string}`

    Parameters

    • hexOrCode: T

      Hex string or Minecraft color code.

    Returns MinecraftColor<number, number, number>

  • Returns a new MinecraftColor with the given color code.

    Returns

    A new MinecraftColor.

    Parameters

    • code: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "0" | "a" | "b" | "c" | "d" | "e" | "f"

      Minecraft color code.

    Returns MinecraftColor<number, number, number>

Generated using TypeDoc