AlexvZyl / nordic.nvim

🌒 Nord for Neovim, but warmer and darker. Supports a variety of plugins and other platforms.
MIT License
709 stars 44 forks source link

Change background color for selected lines with nvim-cmp #135

Closed henrikig closed 1 week ago

henrikig commented 4 months ago

Hi,

I can't find a way to change the background color of the selected/highlighted line in the dropdown-menu that shows up when e.g. nvim-cmp comes with completion suggestions. As of now, the color of the highlighted item is very hard to separate from the other items. Are there any settings I can use to e.g. make the background color any brighter?

image

5-pebbles commented 4 months ago

As long as you don't have custom highlights set in your nvim-cmp config this should work:

require("nordic").setup({
    override = {
        PmenuSel = { bg = "#CB775D" }
    }
})

image

To set the default color use Pmenu instead of PmenuSel

require("nordic").setup({
    override = {
        Pmenu = { bg = "#CB775D" }
    }
})

image

henrikig commented 4 months ago

This works perfectly fine, thanks for the quick response!

AlexvZyl commented 4 months ago

Hi,

I can't find a way to change the background color of the selected/highlighted line in the dropdown-menu that shows up when e.g. nvim-cmp comes with completion suggestions. As of now, the color of the highlighted item is very hard to separate from the other items. Are there any settings I can use to e.g. make the background color any brighter?

image

I now realize that those colors are selected based on the assumption that the user will have border chars for that menu. Do you think we should change this @5-pebbles?

5-pebbles commented 4 months ago

I now realize that those colors are selected based on the assumption that the user will have border chars for that menu. Do you think we should change this @5-pebbles?

Yeah, we should; it's very hard to see by default. Actually, bg_popup is defined twice for some reason?

I personally like bg_popup = bg_float with bg_selected = gray2: image & with swap_background = true: image

I also think we should change the light visual selection to gray2 but that's its own thing.

AlexvZyl commented 4 months ago

I now realize that those colors are selected based on the assumption that the user will have border chars for that menu. Do you think we should change this @5-pebbles?

Yeah, we should; it's very hard to see by default. Actually, bg_popup is defined twice for some reason?

I personally like bg_popup = bg_float with bg_selected = gray2: image & with swap_background = true: image

I also think we should change the light visual selection to gray2 but that's its own thing.

Yeah that looks good!

RossBarnie commented 3 months ago

I've been trying this on the dev branch and the colours are the same as reported by OP.

Lazy config:

    'AlexvZyl/nordic.nvim',
    lazy = false,
    priority = 1000,
    branch = "dev",
    config = function()
      require('nordic').load({
        on_highlight = function(highlights, palette)
          highlights.NeoTreeGitUntracked = { fg = palette.magenta.dim } -- this is fine
        end
      })
    end

I've tried adding

highlights.Pmenu = { bg = "#ffffff" }

to the on_highlight function but it doesn't change anything.

5-pebbles commented 3 months ago

I've been trying this on the dev branch and the colours are the same as reported by OP.

Lazy config:

    'AlexvZyl/nordic.nvim',
    lazy = false,
    priority = 1000,
    branch = "dev",
    config = function()
      require('nordic').load({
        on_highlight = function(highlights, palette)
          highlights.NeoTreeGitUntracked = { fg = palette.magenta.dim } -- this is fine
        end
      })
    end

I've tried adding

highlights.Pmenu = { bg = "#ffffff" }

to the on_highlight function but it doesn't change anything.

I can't reproduce your issue:

'AlexvZyl/nordic.nvim',
lazy = false,
priority = 1000,
branch = "dev",
config = function()
    require('nordic').load({
        on_highlight = function(highlights, palette)
            highlights.Pmenu = { bg = "#ffffff" }
        end
    })
end

image

I would guess, however, that your nvim-cmp config is using a different highlight (not Pmenu).

Could you share that config? & Does the override option work on main?

RossBarnie commented 3 months ago

Ignore me, you were absolutely right I had highlight overrides that I completely forgot about in nvim-cmp which explains my issue!

5-pebbles commented 3 months ago

Ignore me, you were absolutely right I had highlight overrides that I completely forgot about in nvim-cmp which explains my issue!

No worries; I spent an hour on the same thing when this issue first opened...