WoW:USERAPI HexToRGB

Revision as of 23:20, 11 February 2007 by WoWWiki>Tekkub (Damnit, I'll get this right eventually)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This page documents a <i>user-defined function</i> that you can copy and paste into your addon. Replace PREFIX with your addon or lib prefix to avoid conflicts between different versions of these functions.

User defined functions


Takes a hex string (must be 6 char long!) and converts it to a RGB set (0-255)

local function HexToRGB(hex)
	local rhex, ghex, bhex = string.sub(hex, 1, 2), string.sub(hex, 3, 4), string.sub(hex, 5, 6)
	return tonumber(rhex, 16), tonumber(ghex, 16), tonumber(bhex, 16)
end