feat(hipatterns): add shorthand hex color support (#2562)
This commit is contained in:
@ -19,6 +19,18 @@ M.plugin = {
|
||||
},
|
||||
highlighters = {
|
||||
hex_color = hi.gen_highlighter.hex_color({ priority = 2000 }),
|
||||
shorthand = {
|
||||
pattern = "#%x%x%x%f[%X]",
|
||||
group = function(_, _, data)
|
||||
---@type string
|
||||
local match = data.full_match
|
||||
local r, g, b = match:sub(2, 2), match:sub(3, 3), match:sub(4, 4)
|
||||
local hex_color = "#" .. r .. r .. g .. g .. b .. b
|
||||
|
||||
return MiniHipatterns.compute_hex_color_group(hex_color, "bg")
|
||||
end,
|
||||
extmark_opts = { priority = 2000 },
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
|
Reference in New Issue
Block a user