Formatting Color Codes - rodrigoo-r/Harmony GitHub Wiki
Explanation
[!IMPORTANT] For your plugin logger, color formatting is applied automatically.
Harmony can colorize messages based on legacy color formatting.
Legacy color codes
Legacy color codes are:
- Dark Red (dark_red) -> &4
- Red (red) -> &c
- Gold (gold) -> &6
- Yellow (yellow) -> &e
- Dark Green (dark_green) -> &2
- Green (green) -> &a
- Aqua (aqua) -> &b
- Dark Aqua (dark_aqua) -> &3
- Dark Blue (dark_blue) -> &1
- Blue (blue) -> &9
- Light Purple (light_purple) -> &d
- Dark Purple (dark_purple) -> &5
- White (white) -> &f
- Gray (gray) -> &7
- Dark Gray (dark_gray) -> &8
- Black (black) -> &0
- Obfuscated -> &k
- Bold -> &l
- Strikethrough -> &m
- Underline -> &n
- Italic -> &o
- Reset the default color -> &r
You can put all them into your messages, and they will be colored. Example:
&aHello world
The output will be `Hello world (colored with green color)
HEX Colors
If the server is running 1.16.5 or newer, HEX colors are supported. For older versions, they will NOT be replaced and the message will be colored using legacy colors.
For 1.16.5 or newer, messages will be colored using legacy colors and HEX coloring.
To colorize a message, you must use MessageColorFormatter.colorize()
.
Example:
MessageColorFormatter.colorize("&aHello world #91ffefColors are supported!");
Gradient Colors
Harmony has its own gradient coloring API. This way you don't need to include any other useless API.
To use it, you can check use the gradient
method.
[!WARNING] This method is NOT supported on MC versions under 1.16.5
Example:
MessageColorFormatter.gradient("Example Message", "#ffdea1", "#e7ffa1");
Example 2:
MessageColorFormatter.gradient("{gradient:#ffdea1:#e7ffa1}Example Message");
Format:
{gradient:from:to}