nvim: add get_hl_hex()
This commit is contained in:
parent
4abb52dcab
commit
4647ded04d
@ -93,4 +93,17 @@ function M.shell_capture(command)
|
||||
return result
|
||||
end
|
||||
|
||||
-- return colours from highlight groups in web notation (#rrggbb)
|
||||
function M.get_hl_hex(hl_group)
|
||||
local hl = vim.api.nvim_get_hl_by_name(hl_group, true)
|
||||
local hl_hex = {}
|
||||
if hl.foreground then
|
||||
hl_hex.foreground = string.format('#%.6x', hl.foreground)
|
||||
end
|
||||
if hl.background then
|
||||
hl_hex.background = string.format('#%.6x', hl.background)
|
||||
end
|
||||
return hl_hex
|
||||
end
|
||||
|
||||
return M
|
||||
|
Loading…
x
Reference in New Issue
Block a user