feat: use new style definitions for hl groups. Keep backward compatibility for string styles
This commit is contained in:
@@ -49,16 +49,21 @@ function M.invert_color(color)
|
||||
end
|
||||
|
||||
---@param group string
|
||||
function M.highlight(group, color)
|
||||
function M.highlight(group, hl)
|
||||
group = ts.get(group)
|
||||
if not group then
|
||||
return
|
||||
end
|
||||
local hl = { fg = color.fg, bg = color.bg, sp = color.sp, link = color.link }
|
||||
if color.style and color.style:lower() ~= "none" then
|
||||
for s in string.gmatch(color.style, "([^,]+)") do
|
||||
hl[s] = true
|
||||
if hl.style then
|
||||
if type(hl.style) == "table" then
|
||||
hl = vim.tbl_extend("force", hl, hl.style)
|
||||
elseif hl.style:lower() ~= "none" then
|
||||
-- handle old string style definitions
|
||||
for s in string.gmatch(hl.style, "([^,]+)") do
|
||||
hl[s] = true
|
||||
end
|
||||
end
|
||||
hl.style = nil
|
||||
end
|
||||
vim.api.nvim_set_hl(0, group, hl)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user