When I want to change the colour of text sent to the chat window I use hexadecimal, like "|cffffff00". What I would like to do, is be able to do is select from a range from RGB (255,0,0) to RGB (0,255,0) (for example).
But as far as I can tell, you need to use the hexadecimal value, not RGB. Being lazy I was hoping there might be someone willing to let me borrow their code ;D or would you have any other suggestions?
local function GetDifficultyLevelColor(level)
local color = GetQuestDifficultyColor(level)
return format("|cff%.2x%.2x%.2x", color.r*255,color.g*255,color.b*255)
end
If you're going to use in-line color formatting like "|cff......." then yes, you need to use the hex codes.
If you're calling :AddMessage() directly, then the optional 2nd, 3rd, and 4th parameters are the RGB values of the default color of that message. They are specified as fractional numbers from 0 to 1, scaling to your 0-255.
When I want to change the colour of text sent to the chat window I use hexadecimal, like "|cffffff00". What I would like to do, is be able to do is select from a range from RGB (255,0,0) to RGB (0,255,0) (for example).
But as far as I can tell, you need to use the hexadecimal value, not RGB. Being lazy I was hoping there might be someone willing to let me borrow their code ;D or would you have any other suggestions?
If you're calling :AddMessage() directly, then the optional 2nd, 3rd, and 4th parameters are the RGB values of the default color of that message. They are specified as fractional numbers from 0 to 1, scaling to your 0-255.
E.g., in
the 'cheese' is dark red (255,0,0), and the other words are in dark blue (0,0,127.5).