onedark.nvim icon indicating copy to clipboard operation
onedark.nvim copied to clipboard

nvim-cmp window with transparency is not fully opaque

Open Kulwinderpal opened this issue 1 year ago • 1 comments

When Using nvim-cmp and onedark with transparency the nvim-cmp window is not fully opaque
Screenshot 2024-12-01 180954

But When using the Catppuccin Colorscheme the nvim-cmp Window is fully opaque Screenshot 2024-12-01 181122

Hardware

Operating System - Windows 11 24H2 Terminal Emulator - Windows Terminal Version 1.21.3231.0 Neovim Version - 0.10.2

Kulwinderpal avatar Dec 02 '24 02:12 Kulwinderpal

@Kulwinderpal Sorry for thedelayed response—I'm currently looking into the issue

navarasu avatar Apr 27 '25 18:04 navarasu

require('cmp').setup({
    window = {
        completion = {
            border = 'rounded',
            winhighlight = "Normal:Normal,FloatBorder:Normal"
        },
        documentation = {
            border = 'rounded',
            winhighlight = "Normal:Normal,FloatBorder:Normal"
        },
    },
})

Add this to your config

deanqx avatar Jul 30 '25 15:07 deanqx

@Kulwinderpal Sorry for thedelayed response—I'm currently looking into the issue

If you haven’t identified the bug yet, I’d be happy to fix it and open a pull request. I’ll begin investigating as soon as you give me the okay. I have never contributed to open source and this would be a great opportunity.

deanqx avatar Jul 30 '25 15:07 deanqx

This is a configuration issue with nvim-cmp's window highlighting. The theme provides proper NormalFloat and Pmenu highlights, but cmp's default winhighlight settings can override them.

Solution (as mentioned by @deanqx in the comments):

Add this to your cmp configuration:

require('cmp').setup({
    window = {
        completion = {
            border = 'rounded',
            winhighlight = "Normal:Normal,FloatBorder:Normal"
        },
        documentation = {
            border = 'rounded',
            winhighlight = "Normal:Normal,FloatBorder:Normal"
        },
    },
})

This tells cmp to use the standard Normal highlight group instead of its own floating window highlights, giving you the opaque background you're expecting.

Alternative - Customize the Pmenu colors if you prefer a different background:

require('onedark').setup({
    highlights = {
        Pmenu = { fg = "$fg", bg = "$bg1" },  -- Adjust bg color as needed
        PmenuSel = { bg = "$bg3" },
    }
})

Closing as this is a cmp configuration choice rather than a theme bug. Feel free to reopen if you have issues with the suggested solutions!

navarasu avatar Nov 07 '25 19:11 navarasu