20 lines
487 B
Lua
20 lines
487 B
Lua
require "ui.globals"
|
|
|
|
local cached_colors = {}
|
|
function 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 setBackgroundColor(c)
|
|
love.graphics.setBackgroundColor(cHex(c))
|
|
end
|
|
|
|
function setColor(c)
|
|
love.graphics.setColor(cHex(c))
|
|
end
|