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

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

Closed
henrikig opened this issue May 24, 2024 · 9 comments · Fixed by #138 or #144
Closed

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

henrikig opened this issue May 24, 2024 · 9 comments · Fixed by #138 or #144
Assignees
Labels
Bug / Poor Colors Something isn't working, unusable or badly designed Fixed on Dev This issue will be fixed in the next release

Comments

@henrikig
Copy link

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
Copy link
Collaborator

5-pebbles commented May 24, 2024

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
Copy link
Author

This works perfectly fine, thanks for the quick response!

@AlexvZyl
Copy link
Owner

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
Copy link
Collaborator

5-pebbles commented May 25, 2024

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.

@5-pebbles 5-pebbles reopened this May 25, 2024
@5-pebbles 5-pebbles self-assigned this May 25, 2024
@AlexvZyl
Copy link
Owner

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!

@AlexvZyl AlexvZyl added the Bug / Poor Colors Something isn't working, unusable or badly designed label May 27, 2024
@RossBarnie
Copy link

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
Copy link
Collaborator

5-pebbles commented Jun 13, 2024

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
Copy link

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

@5-pebbles
Copy link
Collaborator

5-pebbles commented Jun 13, 2024

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...

@AlexvZyl AlexvZyl mentioned this issue Jun 16, 2024
@5-pebbles 5-pebbles added the Fixed on Dev This issue will be fixed in the next release label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug / Poor Colors Something isn't working, unusable or badly designed Fixed on Dev This issue will be fixed in the next release
Projects
None yet
4 participants