🎨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

public 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

  1. Call the hex method of the MessageColors class and pass the message containing hexadecimal color codes as a parameter.

  2. 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