Thread: Setting Colors
View Single Post
11/24/20, 02:27 AM   #4
andy.s
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 40
ESO "RGB" is between 0 and 1, not 0 and 255:

Code:
-- Convert FFFFFF to 1, 1, 1
function Hex2RGB(hex)
    hex = hex:gsub("#", "")
    return tonumber("0x" .. hex:sub(1, 2)) / 255, tonumber("0x" .. hex:sub(3, 4)) / 255, tonumber("0x" .. hex:sub(5, 6)) / 255
end

-- Convert 1, 1, 1 to FFFFFF
function RGB2Hex(r, g, b)
    return string.format("%.2x%.2x%.2x", zo_round(r * 255), zo_round(g * 255), zo_round(b * 255))
end

Last edited by andy.s : 11/24/20 at 02:30 AM.
  Reply With Quote