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

Not setting the background contrast mode as expected #258

Open
Tormenta74 opened this issue Jan 14, 2019 · 5 comments
Open

Not setting the background contrast mode as expected #258

Tormenta74 opened this issue Jan 14, 2019 · 5 comments

Comments

@Tormenta74
Copy link

Tormenta74 commented Jan 14, 2019

At the end of my init.vim I have this line

let g:gruvbox_contrast_dark = 'hard'

as per the documentation on the wiki for setting the background contrast mode. However, when I load Neovim, the change is not applied; when I :so $MYVIMRC it applies the changes. Am I doing something wrong here?

example

@kakig
Copy link

kakig commented Jan 24, 2019

I had the same issue, fixed it by configuring the theme before applying it:

set background=dark
let g:gruvbox_contrast_dark='hard'
colorscheme gruvbox

EDIT: updated variables as others pointed below.

@const-chris
Copy link

I also had a similar issue, and DzKaki's suggestion partially fixed it, but on load I always get the error message:
g:gruvbox_contrast is deprecated; use g:gruvbox_contrast_light and g:gruvbox_contrast_dark instead
repeated three times.

g:gruvbox_contrast does not appear anywhere in my .vimrc except within g:gruvbox_contrast_dark

@rbong
Copy link

rbong commented May 31, 2019

@GHDIShfdiod876dhs I couldn't recreate it with your .vimrc uploaded to github with gruvbox installed (assuming that's an accurate representation of your setup).

Sounds like #73, even though that's an old version.

Also, that warning should not be showing up multiple times.

Is there any reason that an older version might be installed or gruvbox would be loading multiple times?

@Raynou
Copy link

Raynou commented May 2, 2021

Yeah, I had the same issue, in my case, I solved this adding "set background=dark" like this:

colorshceme gruvbox
set background=dark
let g:gruvbox_contrast="hard"

@mukul29
Copy link

mukul29 commented Sep 19, 2021

You need to set the variable (g:gruvbox_contrast_light or g:gruvbox_contrast_dark) before setting the colorscheme.

This is from my .vimrc:

set background=dark
let g:gruvbox_contrast_dark='hard'
colorscheme gruvbox

From my understanding, g:<var_name> are global variables in vimscript and the order of execution matters. colorscheme gruvbox executes gruvbox.vim which expects g:gruvbox_contrast_dark/light to be defined before it is called. So if you define the variable after setting the colorscheme, it will only be detected after reloading your vimrc because global variables aren't cleared on reload.

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

6 participants