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: Incorrect Lualine Highlight #569

Closed
4 tasks done
Isrothy opened this issue Aug 21, 2024 · 9 comments · May be fixed by #616
Closed
4 tasks done

bug: Incorrect Lualine Highlight #569

Isrothy opened this issue Aug 21, 2024 · 9 comments · May be fixed by #616
Labels
bug Something isn't working

Comments

@Isrothy
Copy link

Isrothy commented Aug 21, 2024

Did you check docs and existing issues?

  • I have read all the trouble.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of trouble.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.10.1

Operating system/version

MacOS 14.6.1

Describe the bug

The symbols and separators in Lualine have inconsistent highlights.

QQ_1724208361558

Steps To Reproduce

  1. Use a color scheme, for example, "gbprod/nord.nvim"
return {
    "gbprod/nord.nvim",
    priority = 100,
    lazy = false,
    config = function()
        vim.cmd.colorscheme("nord")
    end,

}
  1. Insert trouble statusline component into into winbar.

Lualine configuration like this:

{
	"nvim-lualine/lualine.nvim",
	lazy = false,
	dependencies = {
		"nvim-tree/nvim-web-devicons",
	},

	config = function()
		local c = require("nord.colors").palette

		local trouble = require("trouble")
		local symbols = trouble.statusline({
			mode = "lsp_document_symbols",
			groups = {},
			title = false,
			filter = { range = true },
			format = "{kind_icon}{symbol.name:Normal}",
			-- The following line is needed to fix the background color
			-- Set it to the lualine section you want to use
			hl_group = "lualine_c_normal",
		})

		require("lualine").setup({
			winbar = {
				lualine_c = {
					{
						symbols.get,
						cond = symbols.has,
					},
				},
			},
		})
	end,
},

Expected Behavior

The symbols and separators in Lualine have should have the same background.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
	spec = {
		{
			"folke/trouble.nvim",
		},
		{
			"neovim/nvim-lspconfig",
			lazy = false,
			config = function()
				require("lspconfig").lua_ls.setup({})
			end,
		},

		-- add any other plugins here
		{
			"gbprod/nord.nvim",
			priority = 100,
			lazy = false,
			config = function()
				vim.cmd.colorscheme("nord")
			end,
		},
		{
			"nvim-lualine/lualine.nvim",
			lazy = false,
			dependencies = {
				"nvim-tree/nvim-web-devicons",
			},

			config = function()
				local c = require("nord.colors").palette

				local trouble = require("trouble")
				local symbols = trouble.statusline({
					mode = "lsp_document_symbols",
					groups = {},
					title = false,
					filter = { range = true },
					format = "{kind_icon}{symbol.name:Normal}",
					-- The following line is needed to fix the background color
					-- Set it to the lualine section you want to use
					hl_group = "lualine_c_normal",
				})

				require("lualine").setup({
					winbar = {
						lualine_c = {
							{
								symbols.get,
								cond = symbols.has,
							},
						},
					},
				})
			end,
		},
	},
})
@Isrothy Isrothy added the bug Something isn't working label Aug 21, 2024
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Sep 21, 2024
@qeisar
Copy link

qeisar commented Sep 22, 2024

Same issue with various color schemes: tokyonight, catppucin, kanagawa.

@github-actions github-actions bot removed the stale label Sep 23, 2024
@alex35mil
Copy link
Contributor

Try setting StatusLine highlight.

@Isrothy
Copy link
Author

Isrothy commented Oct 3, 2024

Try setting StatusLine highlight.

Thank you, but it doesn't work. Nothing changes.

@alex35mil
Copy link
Contributor

@Isrothy ah sorry, I missed you have it in a winbar. I fixed my issues with status bar and tab bar by adjusting StatusLine and TabLine highlights. There should be similar highlight for a winbar I believe.

@alex35mil
Copy link
Contributor

AFAICT it’s WinBar and WinBarNC.

@Isrothy
Copy link
Author

Isrothy commented Oct 4, 2024

Thanks. It works!

@Isrothy Isrothy closed this as completed Oct 4, 2024
@danielwe
Copy link

I'm also experiencing this issue. Since the underlying problem has not been solved, perhaps the issue should be reopened? It appears every time trouble and lualine are used together with almost any colormap that is not tokyonight or catppuccin. There are at least three open LazyVim discussions about this: LazyVim/LazyVim#3459, LazyVim/LazyVim#3583, LazyVim/LazyVim#4071.

Evidently, the fundamental problem is that trouble.statusline(opts) does not apply opts.hl-group to the entire status string, but leaves gaps that end up falling back to a different highlight group. That's as far as I could get; I'm afraid I don't have the Lua chops to work out a solution.

@EasonMo
Copy link

EasonMo commented Jan 16, 2025

@danielwe In your configuration try to make it effective. It works in my config file as options.lua#L61-L61.

vim.api.nvim_set_hl(0, "StatusLine", { link = "lualine_c_normal" })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants