@myrroddin:
Since Cataclysm the RAID_CLASS_COLORS table for each class has included a preformatted color string, so if you're using them inline in a font string, there's no need to construct your own color string from the r/g/b keys; just use the preformatted one from the "colorStr" key.
@Wilcoh:
I believe this was originally posted in an unrelated thread about LuaTexts, so I assume you to color something using LuaTexts, in which case it would be helpful if you posted whatever LuaTexts strings you're already using, but generally speaking:
Code:
function(unit)
-- insert whatever code you already have,
-- but instead of the "return" line, assign the text
-- to a variable called "text", eg.
local text = "Hello!"
if UnitIsPlayer(unit) then
local _, class = UnitClass(unit)
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class].colorStr
return format("|c%s%s|r", color, text)
else
return text
end
end
If you need more specific help, please post (a) which addon you are using and (b) what LuaTexts strings you are already using.