Closed tomaskallup closed 1 year ago
The synIDattr()
function doesn't distinguish between gui/cterm values, it just returns what's currently in use (determined by termguicolors
option). The logic for the warning is simply
local bg = vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID(colour_or_group)), "bg#")
if bg == "" or bg == "none" then
-- Warn
end
so you can see locally why that's being triggered. I've tried with the material config you provided and don't see the warning so there might be something else setting the highlight?
Running :echo synIDattr(synIDtrans(hlID('Normal')), 'bg#')
results in #0f111a
.
Same result with lua :lua print(vim.inspect(vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID("Normal")), "bg#")))
results in "#0f111a"
.
OK since I can't reproduce you'll either need to provide a minimal init.lua
that reproduces or you can try debugging yourself by adding a print for the value as the warning is emitted in config module https://github.com/rcarriga/nvim-notify/blob/master/lua/notify/config/init.lua#L71
Seems like in that part of code, the background is ""
.
I tried running :verbose hi Normal
and it's same before and after the first notification.
However, I just noticed this problem only happens when the notification is triggered from nvim-tree, if I do :lua vim.notify('Test')
from a regular buffer, the background is set and no warning shows up. If I run the same command inside nvim-tree (or just do any action that creates a notification eg. rename a file) the background reports as empty and warning is shown.
I too am seeing the same issue. For me it seems to be when I have my TokyoNight theme settings to show a transparent background...
require("tokyonight").setup({
style = "night",
transparent = true,
styles = {
sidebars = "transparent",
floats = "transparent",
},
})
When I comment out the transparent settings I don't see the warning popup...
require("tokyonight").setup({
style = "night",
-- transparent = true,
-- styles = {
-- sidebars = "transparent",
-- floats = "transparent",
-- },
})
I too have the tokyonight theme and see the same problem with transparency.
@bushblade @zakissimo This is the expected behaviour, please follow the notification and set the background_colour
setting. This issue is for when a transparent background is not being used.
@tomaskallup I believe I've found the issue, it's due to nvim-tree using a custom winhl
setting and how the underlying implementation of it changed in latest neovim. Please try the latest commit
Hi @rcarriga thanks for the reply. How do you set the background_colour? Do you mean for nvim-notify? I don't see it documented where that is a setting. Wouldn't setting a background colour defeat the purpose of a transparent background though? i.e. using tokyonight transparent doesn't set any background colours so it just uses your terminal background. I'm actually using this plugin via Noice not sure if that makes any difference though.
For nvim-notify to provide an opacity effect, it must know the background colour to fade to/from. If you don't have a background colour for the "Normal" highlight group, it will not know what colour to use so you must tell it. This should be whatever your terminal background colour is (even if it is somewhat transparent itself).
The notification tells you how to set it
notify.setup({
background_colour = "#121212", --Change to terminal background colour
})
@rcarriga Thanks, sorry yes I did notice that just after. This seems to work for me in my Noice setup...
use({
"folke/noice.nvim",
event = "VimEnter",
config = function()
require("noice").setup()
require("notify").setup({
background_colour = "#1a1b26",
})
end,
requires = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
})
@rcarriga Thanks, with the latest commit it seems to work fine.
Hello, first thanks for this great plugin!
After updating, I keep seeing
Highlight group 'Normal' has no background highlight
notification the first time a notification is displayed. I have no idea why this shows up, because myNormal
highlight has background color: I modified my config to include thebackground_colour
, but the warning still seems like a bug to me. By quick glance it seems only thebg
property is checked, but not theguibg
.I'm using
material.nvim
colorscheme (if that somehow relates):