mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-28 03:30:12 +02:00
feat(hipatterns): add shorthand hex color support (#2562)
This commit is contained in:
parent
d9f5e6db16
commit
a8eeb1b75d
1 changed files with 12 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue