Enum Class Colors
- All Implemented Interfaces:
Serializable
,Comparable<Colors>
,Constable
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";
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAqua color (§b) - RGB: 0x55FFFFBlack color (§0) - RGB: 0x000000Blue color (§9) - RGB: 0x5555FFDark Aqua color (§3) - RGB: 0x00AAAADark Blue color (§1) - RGB: 0x0000AADark Gray color (§8) - RGB: 0x555555Dark Green color (§2) - RGB: 0x00AA00Dark Purple color (§5) - RGB: 0xAA00AADark Red color (§4) - RGB: 0xAA0000Gold color (§6) - RGB: 0xFFAA00Gray color (§7) - RGB: 0xAAAAAAGreen color (§a) - RGB: 0x55FF55Light Purple color (§d) - RGB: 0xFF55FFRed color (§c) - RGB: 0xFF5555White color (§f) - RGB: 0xFFFFFFYellow color (§e) - RGB: 0xFFFF55 -
Method Summary
-
Enum Constant Details
-
BLACK
Black color (§0) - RGB: 0x000000 -
DARK_BLUE
Dark Blue color (§1) - RGB: 0x0000AA -
DARK_GREEN
Dark Green color (§2) - RGB: 0x00AA00 -
DARK_AQUA
Dark Aqua color (§3) - RGB: 0x00AAAA -
DARK_RED
Dark Red color (§4) - RGB: 0xAA0000 -
DARK_PURPLE
Dark Purple color (§5) - RGB: 0xAA00AA -
GOLD
Gold color (§6) - RGB: 0xFFAA00 -
GRAY
Gray color (§7) - RGB: 0xAAAAAA -
DARK_GRAY
Dark Gray color (§8) - RGB: 0x555555 -
BLUE
Blue color (§9) - RGB: 0x5555FF -
GREEN
Green color (§a) - RGB: 0x55FF55 -
AQUA
Aqua color (§b) - RGB: 0x55FFFF -
RED
Red color (§c) - RGB: 0xFF5555 -
LIGHT_PURPLE
Light Purple color (§d) - RGB: 0xFF55FF -
YELLOW
Yellow color (§e) - RGB: 0xFFFF55 -
WHITE
White color (§f) - RGB: 0xFFFFFF
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-