When setting highlight = true, the component does not correctly "inherit" the background color of the lualine section it is in, resulting in the highlight backgrounds being off
A workaround I found is a rather convoluted function that follows the linked highlights, gets the foreground color, and then sets the background alongside it. A rather convoluted fix:
-- stylua: ignore
local navicHls = { "IconsFile", "IconsModule", "IconsNamespace", "IconsPackage", "IconsClass", "IconsMethod", "IconsProperty", "IconsField", "IconsConstructor", "IconsEnum", "IconsInterface", "IconsFunction", "IconsVariable", "IconsConstant", "IconsString", "IconsNumber", "IconsBoolean", "IconsArray", "IconsObject", "IconsKey", "IconsNull", "IconsEnumMember", "IconsStruct", "IconsEvent", "IconsOperator", "IconsTypeParameter", "Text", "Separator" }
local lualineHl = vim.api.nvim_get_hl(0, { name = "lualine_b_inactive" })
local bg = lualineHl.bg and ("#%06x"):format(lualineHl.bg)
for _, hlName in ipairs(navicHls) do
hlName = "Navic" .. hlName
local orgHl = hlName
local hl
repeat -- follow linked highlights
hl = vim.api.nvim_get_hl(0, { name = hlName })
hlName = hl.link
until not hl.link
vim.api.nvim_set_hl(0, orgHl, { fg = hl.fg, bg = bg })
end
When setting![Pasted image 2024-06-10 at 13 03 33@2x](https://github.com/SmiteshP/nvim-navic/assets/73286100/70a467dc-5353-4c99-b467-47624bf833e1)
highlight = true
, the component does not correctly "inherit" the background color of the lualine section it is in, resulting in the highlight backgrounds being offA workaround I found is a rather convoluted function that follows the linked highlights, gets the foreground color, and then sets the background alongside it. A rather convoluted fix:
the resulting correct look:![Pasted image 2024-06-10 at 13 05 23@2x](https://github.com/SmiteshP/nvim-navic/assets/73286100/ccc5a7dd-9959-460f-8247-fd62813b3f16)