Bug: When `highlight = true`, does not inherit the background color of the lualine section
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
the resulting correct look:
+1
i fixed this by setting WinBar and WinBarNC highlights to the color i needed
i fixed this by setting
WinBarandWinBarNChighlights to the color i needed
If you use the same background color for both, you can't differentiate between the active and inactive window/buffer.
Do any of guys have an idea how i could get this to work, when the background color may change when switching modes?