🎨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
hexpublic static String hex(String message)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
hexmethod of theMessageColorsclass 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
String message = "This is a message with #FF0000 red color.";
String formattedMessage = MessageColors.hex(message);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