nested & NONE colors override added (#84)

This commit is contained in:
Kaiz Khatri
2021-08-05 12:58:18 +05:30
committed by GitHub
parent 148175ab9d
commit 26c68031b3

View File

@@ -245,21 +245,26 @@ end
function util.color_overrides(colors, config)
if type(config.colors) == "table" then
for key, value in pairs(config.colors) do
if not colors[key] then
error("Color " .. key .. " does not exist")
end
if string.sub(value, 1, 1) == "#" then
if not colors[key] then error("Color " .. key .. " does not exist") end
-- Patch: https://github.com/ful1e5/onedark.nvim/issues/6
if type(colors[key]) == "table" then
util.color_overrides(colors[key], { colors = value })
else
if value:lower() == "none" then
-- set to none
colors[key] = "NONE"
elseif string.sub(value, 1, 1) == "#" then
-- hex override
colors[key] = value
else
-- another group
if not colors[value] then
error("Color " .. value .. " does not exist")
end
if not colors[value] then error("Color " .. value .. " does not exist") end
colors[key] = colors[value]
end
end
end
end
end
function util.light(brightness)