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

Setting background to light and then to dark again changes colors #252

Closed
2 tasks done
Filius-Patris opened this issue Apr 6, 2021 · 2 comments
Closed
2 tasks done

Comments

@Filius-Patris
Copy link

Terminal Emulator Info

alacritty, default.

Output From nvim --version

NVIM v0.5.0-dev+1205-g3f7cd18c4

Issue Description

When run the commands set background=light and then set background=dark again, the colors change:

Default:
Screenshot 2021-04-06 at 14 55 42

After setting background to light and then to dark again:
Screenshot 2021-04-06 at 14 55 56

Thank you for this colorscheme!!

@Filius-Patris
Copy link
Author

Appendum: I just found out that running colorscheme onedark afterwards reverts everything back to normal again.

Close it if you don't consider it a bug.

@joshdick
Copy link
Owner

Excerpt from :help background in Neovim 0.4.4:

When a color scheme is loaded (the "g:colors_name" variable is set)
setting 'background' will cause the color scheme to be reloaded.  If
the color scheme adjusts to the value of 'background' this will work.
However, if the color scheme sets 'background' itself the effect may
be undone.  First delete the "g:colors_name" variable when needed.

onedark.vim does include set background=dark as its very last line to work around a different issue, which is seemingly what's causing the behavior you're seeing (if the color scheme sets 'background' itself the effect may be undone.)

I tried removing set background=dark from onedark.vim itself as a test, and this caused Neovim 0.4.4 not to change any colors at all when manually running set background=light and set background=dark repeatedly. Although this is an odd behavior, because it is easily mitigated by just running colorscheme onedark again, I am going to leave the existing set background=dark in place and close this issue.

Thanks for the report!

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