Package net.minecraft.text
Class TextColor
java.lang.Object
net.minecraft.text.TextColor
public final class TextColor extends Object
- See Also:
Style
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method 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()
-
Field Details
-
FORMATTING_TO_COLOR
-
BY_NAME
-
rgb
private final int rgb -
name
-
-
Constructor Details
-
TextColor
-
TextColor
private TextColor(int rgb)
-
-
Method Details
-
getRgb
@Environment(CLIENT) public int getRgb()Gets the RGB value of this color.The red bits can be obtained by
(rgb >> 16) & 0xFF
, green bits by(rgb >> 8) & 0xFF
, blue bits byrgb & 0xFF
. -
getName
Gets the name of this color, used for converting the color to JSON format. -
getHexCode
-
equals
-
hashCode
public int hashCode() -
toString
-
fromFormatting
Obtains a text color from a formatting.- Parameters:
formatting
- the formatting
-
fromRgb
Obtains a text color from an RGB value.- Parameters:
rgb
- the RGB color
-
parse
Parses a color by its name.- Parameters:
name
- the name
-