uiUtils = {}

local cached_colors = {}
function uiUtils.cHex(rgb)
    if cached_colors[rgb] then return unpack(cached_colors[rgb]) end
    r = tonumber(string.sub(rgb, 1, 2), 16) / 255
    g = tonumber(string.sub(rgb, 3, 4), 16) / 255
    b = tonumber(string.sub(rgb, 5, 6), 16) / 255
    cached_colors[rgb] = {r, g, b}
    return r, g, b
end

function uiUtils.convertColors(ct)
    local nct = {}
    for k, v in pairs(ct) do
        nct[k] = uiUtils.cHex(v)
    end
    return nct
end

function uiUtils.setBackgroundColor(c)
    love.graphics.setBackgroundColor(uiUtils.cHex(c))
end

function uiUtils.setColor(c)
    love.graphics.setColor(uiUtils.cHex(c))
end

return uiUtils
