Question Usage of color codes / hex

Burglar

New member
Jul 5, 2022
1
0
1
Hello, How can i use color codes or hex in a more easier way instead of:
Java:
player.sendMessage(Component.text("test").color(NamedTextColor.COLOR));

Because in Spigot i used to use this:
Java:
public static String color(String text){


      return ChatColor.translateAlternateColorCodes('&', text);


}


player.sendMessage(color("&fMessage"));
 

Machine Maker

Paper Developer
Staff member
Dec 17, 2021
132
6
19
18
California
I don't think you meant to post this on the velocity plugin development forum? Velocity is a server proxy (like BungeeCord or Waterfall). So I moved it for you.

We encourage you to not use legacy text formatting with § or & and ChatColor.translateAlternateColorCodes. We encourage you to either just use Components to color text like Component.text("test", NamedTextColor.RED) or text("test", RED) with static imports (read these docs), OR use MiniMessage, which is a string representation of components (read these docs).
 
  • Like
Reactions: CrazyCloudCraft