Enum Class Colors

java.lang.Object
java.lang.Enum<Colors>
com.kamikazejam.kamicommon.nms.util.Colors
All Implemented Interfaces:
Serializable, Comparable<Colors>, Constable

public enum Colors extends Enum<Colors>
Enumeration of Minecraft chat colors with their corresponding AWT Color representations.

This enum provides a mapping between Minecraft's chat color system and Java's Color class, enabling consistent color representation across different contexts such as chat formatting, GUI elements, and graphical operations.

Each color entry contains:

  • A character code used in Minecraft's chat color formatting (§0-§f)
  • A string name matching Minecraft's internal color naming
  • An AWT Color object with the equivalent RGB values

The color values are based on Minecraft's default chat color palette, ensuring visual consistency between in-game text and external applications that need to display Minecraft-styled content.

Example usage:


 // Get the AWT Color for red text
 Color redColor = Colors.RED.getColor();
 
 // Get the chat color code
 char redCode = Colors.RED.getCode(); // 'c'
 
 // Format chat message
 String message = "§" + Colors.RED.getCode() + "This is red text";
 

  • Enum Constant Details

    • BLACK

      public static final Colors BLACK
      Black color (§0) - RGB: 0x000000
    • DARK_BLUE

      public static final Colors DARK_BLUE
      Dark Blue color (§1) - RGB: 0x0000AA
    • DARK_GREEN

      public static final Colors DARK_GREEN
      Dark Green color (§2) - RGB: 0x00AA00
    • DARK_AQUA

      public static final Colors DARK_AQUA
      Dark Aqua color (§3) - RGB: 0x00AAAA
    • DARK_RED

      public static final Colors DARK_RED
      Dark Red color (§4) - RGB: 0xAA0000
    • DARK_PURPLE

      public static final Colors DARK_PURPLE
      Dark Purple color (§5) - RGB: 0xAA00AA
    • GOLD

      public static final Colors GOLD
      Gold color (§6) - RGB: 0xFFAA00
    • GRAY

      public static final Colors GRAY
      Gray color (§7) - RGB: 0xAAAAAA
    • DARK_GRAY

      public static final Colors DARK_GRAY
      Dark Gray color (§8) - RGB: 0x555555
    • BLUE

      public static final Colors BLUE
      Blue color (§9) - RGB: 0x5555FF
    • GREEN

      public static final Colors GREEN
      Green color (§a) - RGB: 0x55FF55
    • AQUA

      public static final Colors AQUA
      Aqua color (§b) - RGB: 0x55FFFF
    • RED

      public static final Colors RED
      Red color (§c) - RGB: 0xFF5555
    • LIGHT_PURPLE

      public static final Colors LIGHT_PURPLE
      Light Purple color (§d) - RGB: 0xFF55FF
    • YELLOW

      public static final Colors YELLOW
      Yellow color (§e) - RGB: 0xFFFF55
    • WHITE

      public static final Colors WHITE
      White color (§f) - RGB: 0xFFFFFF
  • Method Details

    • values

      public static Colors[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Colors valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null