aboutsummaryrefslogtreecommitdiffhomepage
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 9a56f2a5..36ba839c 100644
--- a/init.lua
+++ b/init.lua
@@ -35,7 +35,11 @@ local function set_theme(view, name, options)
-- be captured later during init.
local property = view.property
local colors = setmetatable({}, {__newindex = function(t, name, color)
- property['color.' .. name] = color -- TODO: auto-convert '#RRGGBB'?
+ if type(color) == 'string' then
+ local r, g, b = color:match('^#(%x%x)(%x%x)(%x%x)$')
+ color = tonumber(string.format('%s%s%s', b, g, r), 16) or 0
+ end
+ property['color.' .. name] = color
rawset(t, name, color) -- cache instead of __index for property[...]
end})
local styles = setmetatable({}, {__newindex = function(_, name, props)