mirror of
https://github.com/gabehf/base46.git
synced 2026-03-14 09:46:00 -07:00
feat: allow changing color lightness for hl_override/add colors
This commit is contained in:
parent
bad87b0344
commit
acbe7c0e83
1 changed files with 6 additions and 4 deletions
|
|
@ -23,6 +23,8 @@ M.merge_tb = function(...)
|
||||||
return vim.tbl_deep_extend("force", ...)
|
return vim.tbl_deep_extend("force", ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local change_hex_lightness = require("base46.colors").change_hex_lightness
|
||||||
|
|
||||||
-- turns color var names in hl_override/hl_add to actual colors
|
-- turns color var names in hl_override/hl_add to actual colors
|
||||||
-- hl_add = { abc = { bg = "one_bg" }} -> bg = colors.one_bg
|
-- hl_add = { abc = { bg = "one_bg" }} -> bg = colors.one_bg
|
||||||
M.turn_str_to_color = function(tb)
|
M.turn_str_to_color = function(tb)
|
||||||
|
|
@ -31,10 +33,10 @@ M.turn_str_to_color = function(tb)
|
||||||
|
|
||||||
for _, hlgroups in pairs(copy) do
|
for _, hlgroups in pairs(copy) do
|
||||||
for opt, val in pairs(hlgroups) do
|
for opt, val in pairs(hlgroups) do
|
||||||
if
|
if opt == "fg" or opt == "bg" or opt == "sp" then
|
||||||
(opt == "fg" or opt == "bg" or opt == "sp") and not (val:sub(1, 1) == "#" or val == "none" or val == "NONE")
|
if not (type(val) == "string" and val:sub(1, 1) == "#" or val == "none" or val == "NONE") then
|
||||||
then
|
hlgroups[opt] = type(val) == "table" and change_hex_lightness(colors[val[1]], val[2]) or colors[val]
|
||||||
hlgroups[opt] = colors[val]
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue