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

Change highlight color after initialization #134

Open
xeruf opened this issue Jun 17, 2020 · 2 comments
Open

Change highlight color after initialization #134

xeruf opened this issue Jun 17, 2020 · 2 comments

Comments

@xeruf
Copy link

xeruf commented Jun 17, 2020

I would like to set the whitespace highlight color depending on the background, which seems to be automatically detected by neovim at some point, but stays at 'dark' while my vimrc is being loaded.

So I tried this:

let g:better_whitespace_guicolor='Brown'
autocmd OptionSet background let g:better_whitespace_guicolor=&background == 'light' ? 'LightYellow' : 'Brown'

Then, after background is set to 'light', :echo g:better_whitespace_guicolor returns 'LightYellow', yet the whitespace is highlighted in Brown.

@Cimbali
Copy link
Collaborator

Cimbali commented Jul 17, 2020

This is indeed not supported yet. You can probably use the command to modify the highlight group directly, in addition to setting the variable:

:highlight ExtraWhitespace guibg='LightYellow'

Also it might be ctermbg you want and not guibg if your neovim is running in a terminal rather than a window.

@Cimbali Cimbali changed the title Can't change highlight color after initialization Change highlight color after initialization Jul 17, 2020
@xeruf
Copy link
Author

xeruf commented Jul 27, 2020

Since I'm using termguicolors, guibg is correct here. Thanks :)

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

No branches or pull requests

2 participants