rcarriga / nvim-notify

A fancy, configurable, notification manager for NeoVim
MIT License
3k stars 80 forks source link

Highlight group 'Normal' has no background highlight. Please provide an RGB hex value or highlight group with a background value for 'background_colour' option Defaulting to #000000 #101

Closed Yan-weihao closed 2 years ago

Yan-weihao commented 2 years ago

I try to use transparent window but it gives warning

image
rcarriga commented 2 years ago

I've improved the warning message, let me know if it is still unclear :smile:

Yan-weihao commented 2 years ago

this is the new error

2022-06-05_21-28
Yan-weihao commented 2 years ago

background_colour = "Normal", What value should I set this to?

Yan-weihao commented 2 years ago

I've improved the warning message, let me know if it is still unclear :smile:

How do I set up a highlight group with a background

rcarriga commented 2 years ago

You need to provide a colour to be used for when a window is fully transparent. True transparency is not possible in a terminal so it's faked by setting the window/text to the background colour. Whatever background colour you use for your terminal is a good choice. Looking at your dotfiles I can see you have it set to 0x282A36 so pass #282A36 to the notify setup function

Yan-weihao commented 2 years ago

So how can I use nvim-notify in transparent window

Yan-weihao commented 2 years ago

The error exists no matter what value I set background_colour to

Yan-weihao commented 2 years ago

My notification background is already transparent, but it still warns me

image
Yan-weihao commented 2 years ago

I changed the highlight group

2022-06-06_20-01
Yan-weihao commented 2 years ago

当窗口完全透明时,您需要提供一种颜色。真正的透明度在终端中是不可能的,因此它是通过将窗口/文本设置为背景颜色来伪造的。无论您为终端使用什么背景颜色都是不错的选择。查看您的点文件,我可以看到您已将其设置为0x282A36传递给通知设置功能#282A36

how should i use my own highlight group or what color should i give it

rcarriga commented 2 years ago

As stated in the warning, provide a colour to the setup

require("notify").setup({
  background_colour = "#282A36"
})
Yan-weihao commented 2 years ago

it doesn't seem to take effect

2022-06-06_20-12

如警告中所述,为设置提供颜色

require("notify").setup({
  background_colour = "#282A36"
})
rcarriga commented 2 years ago

~Can you show me exactly what you're providing to the setup?~ I can see in the screenshot, are you calling setup twice?

Yan-weihao commented 2 years ago

this is my config file

`local status_ok, notify = pcall(require, "notify") if not status_ok then vim.notify("notify module not found!") return end

require("notify")("严伟浩欢迎你") vim.notify = notify require("notify").setup({ active = true, on_config_done = nil, -- Animation style (see below for details) stages = "slide", -- Function called when a new window is opened, use for changing win settings/config on_open = nil, -- Function called when a window is closed on_close = nil, -- Render function for notifications. See notify-render() render = "default", -- Default timeout for notifications timeout = 1000, -- Max number of columns for messages max_width = nil, -- Max number of lines for a message max_height = nil, -- For stages that change opacity this is treated as the highlight behind the window -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values background_colour ="#282A36", -- Minimum width for notification windows minimum_width = 50, -- Icons for the different levels icons = { ERROR = "", WARN = "", INFO = "", DEBUG = "", TRACE = "✎", }, }) `

rcarriga commented 2 years ago

This line require("notify")("严伟浩欢迎你") you're sending a notification before setup so the default config is used and triggers the warning. Remove that line

Yan-weihao commented 2 years ago

此行require("notify")("严伟浩欢迎你")您在设置之前发送通知,因此使用默认配置并触发警告。删除该行

thank you, i solved the problem,