Skip to content

Commit b0da066

Browse files
committed
feat(util): get hl color
1 parent 0177079 commit b0da066

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lua/snacks/util.lua

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ function M.set_hl(groups, opts)
2626
end
2727
end
2828

29+
---@param group string
30+
---@param prop? string
31+
function M.color(group, prop)
32+
prop = prop or "fg"
33+
local hl = vim.api.nvim_get_hl(0, { name = group, link = false })
34+
return hl[prop] and string.format("#%06x", hl[prop])
35+
end
36+
2937
---@param win number
3038
---@param wo vim.wo
3139
function M.wo(win, wo)

0 commit comments

Comments
 (0)