Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: When highlight = true, does not inherit the background color of the lualine section #146

Open
chrisgrieser opened this issue Jun 10, 2024 · 3 comments

Comments

@chrisgrieser
Copy link

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
Pasted image 2024-06-10 at 13 03 33@2x

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:
Pasted image 2024-06-10 at 13 05 23@2x

@iFarmGolems
Copy link

+1

@renxzen
Copy link

renxzen commented Jun 26, 2024

i fixed this by setting WinBar and WinBarNC highlights to the color i needed

@azzamsa
Copy link

azzamsa commented Oct 14, 2024

i fixed this by setting WinBar and WinBarNC highlights 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants