Skip to content

Commit

Permalink
Merge pull request #726 from bvtthead/highlight-link
Browse files Browse the repository at this point in the history
  • Loading branch information
CKolkey authored Aug 9, 2023
2 parents 6bf97d4 + d1348a6 commit 5588603
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lua/neogit/lib/hl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,23 @@ end

---@param name string Syntax group name.
local function get_fg(name)
local color = vim.api.nvim_get_hl(0, { name = name })["fg"]
if color then
return "#" .. to_hex(color)
local color = vim.api.nvim_get_hl(0, { name = name })
if color["link"] then
return get_fg(color["link"])
end
if color["fg"] then
return "#" .. to_hex(color["fg"])
end
end

---@param name string Syntax group name.
local function get_bg(name)
local color = vim.api.nvim_get_hl(0, { name = name })["bg"]
if color then
return "#" .. to_hex(color)
local color = vim.api.nvim_get_hl(0, { name = name })
if color["link"] then
return get_bg(color["link"])
end
if color["bg"] then
return "#" .. to_hex(color["bg"])
end
end

Expand Down

0 comments on commit 5588603

Please sign in to comment.