Message Colors
Use hex colors and regular colors inside of messages, lore and other stuff!
Overview
The MessageColors
class provides a utility method to convert hexadecimal color codes to Minecraft color codes in messages.
Methods
hex
hex
Converts hexadecimal color codes in a message to Minecraft color codes.
Parameters
message
: The message containing hexadecimal color codes to be converted.
Returns
String
: The message with converted color codes.
Usage
Call the
hex
method of theMessageColors
class and pass the message containing hexadecimal color codes as a parameter.The method will replace hexadecimal color codes in the message with their corresponding Minecraft color codes.
Example
In this example, the hexadecimal color code #FF0000
will be converted to the corresponding Minecraft color code for red. The resulting formattedMessage
will contain the message with the color applied.
Last updated