Thanks for the reply! I actually had gone about it with another solution, but I appreciate you offering yours as it seems a bit cleaner (in mine I have to access the class name and my method feels a bit hacky). Here’s the strategy I used:
// Also colorize names in the real-time chat
api.decorateChatMessage(function (messageContainer, chatChannel)
{
let colorized_groups = this.args?.message?.user?.colorized_groups;
if (colorized_groups == null)
return; // no groups, nothing to do
const nameClass = "chat-message-info__username__name";
let elements = messageContainer.getElementsByClassName(nameClass);
if (elements.length == 0) // normal: this might be a second message that does not have the username header
return;
let nameDiv = elements[0];
if (colorized_groups.indexOf("developer") > -1)
nameDiv.classList.add("developer");
else if (colorized_groups.indexOf("wip_researcher") > -1)
nameDiv.classList.add("wip_researcher");
else if (colorized_groups.indexOf("researcher") > -1)
nameDiv.classList.add("researcher");
});
I assume with your method, it also still passes the this.args.message.user ?