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 booleanequals(Object object)static TextColorfromFormatting(Formatting formatting)Obtains a text color from a formatting.static TextColorfromRgb(int rgb)Obtains a text color from an RGB value.private StringgetHexCode()StringgetName()Gets the name of this color, used for converting the color to JSON format.intgetRgb()Gets the RGB value of this color.inthashCode()static TextColorparse(String name)Parses a color by its name.StringtoString()
-
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
-