nvim-notify icon indicating copy to clipboard operation
nvim-notify copied to clipboard

Popup window still has a pink background after set background_colour to #000000

Open AeolusLau opened this issue 3 years ago • 7 comments

Environment:

  • Latest macOS: 13.2.1,
  • Latest iTerm2: 3.4.19, with configure of a transparent background,
  • Latest Neovim: 0.8.3, highlight group 'Normal' is cleared by default,
  • Latest vim-plug,
  • Latest nvim-notify,
  • Latest coc.nvim, (The question goes on even if I delete coc.nvim.)
  • Set background_colour to "#000000", (or to anything, it doesn't matter)

What's wrong:

  • The popup window of nvim-notify still has a pink background.
  • The question goes on when I clean install only neovim & vim-plug & nvim.notify, and set only termguicolors & vim.notify & background_colours in a ubuntu docker.

Question:

  • How can I fix this?
  • Any help will be appreciated.

image

AeolusLau avatar Mar 27 '23 06:03 AeolusLau

The background_colour is to tell nvim-notify what the highlight behind windows should be i.e. what colour a transparent window should be. It does not set the highlight of an opaque window.

You want to override the highlights as defined here https://github.com/rcarriga/nvim-notify/blob/02047199e2752223c77c624160f720ca227944a9/lua/notify/config/highlights.lua#L5-L28

rcarriga avatar Mar 28 '23 21:03 rcarriga

The background_colour is to tell nvim-notify what the highlight behind windows should be i.e. what colour a transparent window should be. It does not set the highlight of an opaque window.

You want to override the highlights as defined here

https://github.com/rcarriga/nvim-notify/blob/02047199e2752223c77c624160f720ca227944a9/lua/notify/config/highlights.lua#L5-L28

This seems not to be the resolution of my issue. I don't want to override these highlights. I just want a transparent or at least dim background, not the current pink one.

I gave up, after quite a few tries. Now I just give Normal a black guibg. Everything seems okey now, expect that the background of neovim is black too, not transparent any more.

Thanks a lot. The plugin is awesome.

AeolusLau avatar Mar 30 '23 05:03 AeolusLau

@rcarriga

If NotifyBackground xxx links to Normal and Normal xxx guifg=#b0bec5 guibg=#25363b...

Why do I get this notification every time I start neovim?

Highlight group 'NotifyBackground' has no background highlight Please provide an RGB hex value or highlight group with a background value for 'background_colour' option. This is the colour that will be used for 100% transparency.

require("notify").setup({
  background_colour = "#000000",
})

Defaulting to #000000

aquillano avatar Apr 10 '23 16:04 aquillano

Currently experiencing the same issue. This is the message it returns every time I start neovim.

Highlight group 'NotifyBackground' has no background highlight
Please provide an RGB hex value or highlight group with a background value for 'background_colour' option.
This is the colour that will be used for 100% transparency.
require("notify").setup({
  background_colour = "#000000",
})
Defaulting to #000000

I've installed LazyVim and according to their documentation I can customise or add plugins really easy in the ~/.config/nvim/lua/plugins/ directory. My configuration looks like this right now:

return {

  -- Treesitter
  {
    "nvim-treesitter/nvim-treesitter",
    opts = {
      ensure_installed = {
        "bash",
        "help",
        "html",
        "css",
        "javascript",
        "json",
        "lua",
        "markdown",
        "markdown_inline",
        "query",
        "regex",
        "tsx",
        "vim",
        "yaml",
        "dockerfile",
        "python",
      },
    },
  },

  -- For the transparent background in Lazyvim
  {
    "folke/tokyonight.nvim",
    opts = {
      transparent = true,
      styles = {
        sidebars = "transparent",
        floats = "transparent",
      },
    },
  },

  -- Nvim-Notify
  {
    "rcarriga/nvim-notify",
    opt = {
      background_colour = "#000000",
    },
  },
}

But the message won't get away..

lucasscheepers avatar Apr 10 '23 18:04 lucasscheepers

@AeolusLau You should just be able to set the NotifyBackground highlight to have a transparent background. I'm not sure why it's pink without being able to reproduce your setup.

@aquillano I'm not sure, my guess would be that you're not setting termguicolors before nvim-notify is setup. The code doing this check is very simple if you want to debug https://github.com/rcarriga/nvim-notify/blob/02047199e2752223c77c624160f720ca227944a9/lua/notify/config/init.lua#L69-L70

@lucasscheepers I'm not familiar with LazyVim, but I'm guessing it's because you have opt = ... rather than opts = ... for nvim-notify

rcarriga avatar Apr 15 '23 09:04 rcarriga

@rcarriga Oh wow, yeah it was a typo lol

lucasscheepers avatar Apr 15 '23 10:04 lucasscheepers

vim.cmd([[
hi NotifyBackground guibg = #000000
]])

Adding this on my options.lua file solved the issue for me

srijangyawali avatar Aug 26 '23 01:08 srijangyawali