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

Custome highlight in setup() #162

Closed
rickywu opened this issue Dec 8, 2022 · 7 comments
Closed

Custome highlight in setup() #162

rickywu opened this issue Dec 8, 2022 · 7 comments

Comments

@rickywu
Copy link

rickywu commented Dec 8, 2022

I want to override
highlight NotifyINFOTitle guifg=#A9FF68

because my backgroud is light color, so how should I do this?

I tried but not work

	vim.cmd([[
            hi default NotifyINFOTitle guifg=#4e9a06
        ]]),
@rcarriga
Copy link
Owner

rcarriga commented Dec 8, 2022

Remove the default and it will override the highlight. See :hi-default

@rickywu
Copy link
Author

rickywu commented Dec 9, 2022

	local notify = require("notify")
	local icons = {
		diagnostics = require("modules.ui.icons").get("diagnostics"),
		ui = require("modules.ui.icons").get("ui"),
	}

	notify.setup({
		---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" }
		stages = "slide",
		---@usage Function called when a new window is opened, use for changing win settings/config
		on_open = nil,
		---@usage Function called when a window is closed
		on_close = nil,
		---@usage timeout for notifications in ms, default 5000
		timeout = 2000,
		-- Render function for notifications. See notify-render()
		render = "default",
		---@usage highlight behind the window for stages that change opacity
		background_colour = "Normal",
		---@usage minimum width for notification windows
		minimum_width = 50,
		---@usage notifications with level lower than this would be ignored. [ERROR > WARN > INFO > DEBUG > TRACE]
		level = "TRACE",
		---@usage Icons for the different levels
		icons = {
			ERROR = icons.diagnostics.Error,
			WARN = icons.diagnostics.Warning,
			INFO = icons.diagnostics.Information,
			DEBUG = icons.ui.Bug,
			TRACE = icons.ui.Pencil,
		},
		vim.cmd([[
            hi NotifyINFOIcon guifg=#6b8e23
            hi NotifyINFOTitle guifg=#6b8e23
        ]]),
	vim.notify = notify
	

Did I missed anything? Still not work

@rickywu
Copy link
Author

rickywu commented Dec 9, 2022

I found it use default hi color each time startup, and become customized hi color after isssue PackerSync
Seems not override the default color when startup

@rcarriga
Copy link
Owner

Setting it before or after loading nvim-notify works just fine as long as default is not set. It sounds like you're not compiling your packer config (with PackerCompile) when testing and so you don't see the changes

@rickywu
Copy link
Author

rickywu commented Dec 11, 2022

PackerSync also compile packages

The 1st time use PackerCompile
image

2nd time seems works well
image

After restart:
image

@rcarriga
Copy link
Owner

I'm not sure what is going wrong but it is something wrong with your setup. It looks like the code is not being called for some reason. Closing this, but please re-open if you find an issue within nvim-notify

@rickywu
Copy link
Author

rickywu commented Dec 12, 2022

Just put in colorscheme solved it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants