Styling cannot escape placeholders.
So if you have a prefix like <blue>Admin
the prefix will turn blue but you're username is still white (default).
In this guide I'll show you how you can use the color meta tag of groups in LuckPerms to change the color of your display name.
At the end I also show how you can do this based on dimension.
You have configured LuckPerms groups for your server and set up prefixes display in chat by adding it to display_name.
If you don't want prefixes, you can remove them by searching for %luckperms:prefix%
in your config file and replacing it with nothing.
If you want suffixes as well you can find ${default}"
and replace it with ${default}%luckperms:suffix%"
.
We will use LuckPerms meta to store the color for the groups.
For this we'll use the /lp user/group <user|group> meta set <key> <value> [context...]
command.
Since I used the admin role in my previous guide I'll continue working with it here.
/lp group admin meta set color red
This command set the key color
to value red
for the admin group.
For adding colors to Styled Chat we'll use permission based styles.
Since I just set my color tag in LuckPerms to red, we'll use that as an example.
"styles": [
{
"require": {
"type": "permission",
"permission": "meta.color.red"
},
"display_name": "%luckperms:prefix%<red>${default}"
}
]
Now reload your Styled Configuration (/styledchat reload
). It should add the missing keys and leave their objects empty.
If you now send a message in chat you'll be able to see the color is applied.
Paste these styles into you Styled Chat config to have access to the default Minecraft colors: black
, dark_blue
, dark_green
, dark_aqua
, dark_red
, dark_purple
, gold
, gray
, dark_gray
, blue
, green
, aqua
, red
, light_purple
, yellow
and white
.
{"require":{"type":"permission","permission":"meta.color.black"},"display_name":"%luckperms:prefix%<black>${default}"},
{"require":{"type":"permission","permission":"meta.color.dark_blue"},"display_name":"%luckperms:prefix%<dark_blue>${default}"},
{"require":{"type":"permission","permission":"meta.color.dark_green"},"display_name":"%luckperms:prefix%<dark_green>${default}"},
{"require":{"type":"permission","permission":"meta.color.dark_aqua"},"display_name":"%luckperms:prefix%<dark_aqua>${default}"},
{"require":{"type":"permission","permission":"meta.color.dark_red"},"display_name":"%luckperms:prefix%<dark_red>${default}"},
{"require":{"type":"permission","permission":"meta.color.dark_purple"},"display_name":"%luckperms:prefix%<dark_purple>${default}"},
{"require":{"type":"permission","permission":"meta.color.gold"},"display_name":"%luckperms:prefix%<gold>${default}"},
{"require":{"type":"permission","permission":"meta.color.gray"},"display_name":"%luckperms:prefix%<gray>${default}"},
{"require":{"type":"permission","permission":"meta.color.dark_gray"},"display_name":"%luckperms:prefix%<dark_gray>${default}"},
{"require":{"type":"permission","permission":"meta.color.blue"},"display_name":"%luckperms:prefix%<blue>${default}"},
{"require":{"type":"permission","permission":"meta.color.green"},"display_name":"%luckperms:prefix%<green>${default}"},
{"require":{"type":"permission","permission":"meta.color.aqua"},"display_name":"%luckperms:prefix%<aqua>${default}"},
{"require":{"type":"permission","permission":"meta.color.red"},"display_name":"%luckperms:prefix%<red>${default}"},
{"require":{"type":"permission","permission":"meta.color.light_purple"},"display_name":"%luckperms:prefix%<light_purple>${default}"},
{"require":{"type":"permission","permission":"meta.color.yellow"},"display_name":"%luckperms:prefix%<yellow>${default}"},
{"require":{"type":"permission","permission":"meta.color.white"},"display_name":"%luckperms:prefix%<white>${default}"}
Note that this will add around 160 lines to your config when reloading.
Now you can just set the color
meta key to any of the before mentioned colors and it should just work.
Styled Chat also supports HEX colors, this means we're not limited to those 16 Minecraft colors, let's create one.
"styles": [
{
"require": {
"type": "permission",
"permission": "meta.color.hot_pink"
},
"display_name": "%luckperms:prefix%<#FF69B4>${default}"
}
]
Now you can set the color
meta key to hot_pink
to get a different pink.
You can also modify just the color tag(e.g. <red>
) used in display_name
on an existing color to make it a color you like more.
If you've already created custom styles (e.g. the 16 colors shown above) you can set meta tags that require context, in this case, the "world"(dimension). This should be added to the default group so it applies to everyone.
/lp g default meta set color dark_green world=overworld
/lp g default meta set color dark_red world=the_nether
/lp g default meta set color dark_purple world=the_end
Note that this will not play nice if you've set colors specifically for groups or users. All set colors using meta from applied groups and context will match, meaning there's no priority, they're just all there. Styled Chat handles this by just matching the first one that matches in the config.
As you'll remember from the basics, I set the color of the admin group to red. When I'm in the overworld, it's still dark_green because that comes first in the config.
Permissions can also be set using context, by checking for these permissions we can create styles for those as well. We'll use the "world"(dimension) context again.
Here we set a permission in the dim
(dimension) namespace based on context so they only apply when we're there:
/lp g default permission set dim.overworld true world=overworld
/lp g default permission set dim.nether true world=the_nether
/lp g default permission set dim.end true world=the_end
Then in your Styled Chat config add the custom styles for these permissions:
{"require":{"type":"permission","permission":"dim.overworld"},"display_name":"%luckperms:prefix%<dark_green>${default}"},
{"require":{"type":"permission","permission":"dim.nether"},"display_name":"%luckperms:prefix%<dark_red>${default}"},
{"require":{"type":"permission","permission":"dim.end"},"display_name":"%luckperms:prefix%<dark_purple>${default}"}
Add to the bottom of your styles so other things(like admin groups) take priority.
Also make sure you aren't missing any commas or have too many, decent text editors will show you if something is wrong with your JSON, for example vscode.dev.
As you can see in this image I still have the red display name from my admin role and not dark_green from the dimension I'm in: