You might find some of the code in Blizzard's Util.lua handy. Notably there is a ColorMixin that converts to Hex, a Clamp function, and a WrapTextInColorCode function.
RAID_CLASS_COLORS also already has the color in hex format as the .colorStr so you can save some computation by using that rather than clamping multiple values and reformatting the result.
|