| Modifier and Type | Field and Description |
|---|---|
private static Map<String,TextColor> |
BY_NAME |
private static Map<Formatting,TextColor> |
FORMATTING_TO_COLOR |
private String |
name |
private int |
rgb |
| Modifier | Constructor and Description |
|---|---|
private |
TextColor(int rgb) |
private |
TextColor(int rgb,
String name) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object object) |
static TextColor |
fromFormatting(Formatting formatting)
Obtains a text color from a formatting.
|
static TextColor |
fromRgb(int rgb)
Obtains a text color from an RGB value.
|
private String |
getHexCode() |
String |
getName()
Gets the name of this color, used for converting the color to JSON format.
|
int |
getRgb()
Gets the RGB value of this color.
|
int |
hashCode() |
static TextColor |
parse(String name)
Parses a color by its name.
|
String |
toString() |
private static final Map<Formatting,TextColor> FORMATTING_TO_COLOR
private final int rgb
private TextColor(int rgb,
String name)
private TextColor(int rgb)
@Environment(value=CLIENT) public int getRgb()
The red bits can be obtained by (rgb >> 16) & 0xFF, green bits
by (rgb >> 8) & 0xFF, blue bits by rgb & 0xFF.
public String getName()
private String getHexCode()
@Nullable public static TextColor fromFormatting(Formatting formatting)
formatting - the formattingpublic static TextColor fromRgb(int rgb)
rgb - the RGB color