-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Automatic day/night colors switching based on vim.o.background #63
Comments
Thanks for the suggestion! I will try and implement this around the logic I've already got for the toggle command. Quick question - with your current configuration with tokyonight.nvim, do you have to close and re-open Neovim, or does it change in realtime? I'm just wondering if I need to hook into the OptionSet event or just apply the change on initial setup. |
So there is voodoo magic that auto-refreshes the colorscheme to the new variant when setting Either way, both options can live harmoniously together and people can pick and choose what they want. If you want to take advantage of this, you can set I did end up creating an autocmd after all so we can also use this to set the lualine theme on the fly as well as trigger any custom user autocmds with the Hope you like it! Thanks again for the suggestion, I appreciate your support for the project 🙂 |
Thanks for the extensive testing @strayer ! I've fixed the logic of the autocmd so it only runs when cyberdream is the current selected Neovim colorscheme. I'm gonna need some time to think about the other problems and how best to approach them. I've made it somewhat difficult for myself with lualine support and two distinct ways of switching the theme. Two issues left to resolve:
|
Okay, both of the issues mentioned in my previous comment should now be resolved. Unfortunately the fix has resulted in a breaking change for the lualine theme which I've documented in #65 (pinned issue). Can you retest after updating to v2.0.0 and making the required change to your lualine.nvim config? |
Ignore my last comment, it turns out I didn't need to introduce breaking changes after all. You shouldn't need to make any config updates for this to work now. Knowing my luck, I've probably missed an edge case somewhere along the way. Appreciate if you could test and let me know 🙂 |
Thanks for taking your time to work on this! The lualine is now always the correct color scheme on start. The issue with the black & white lualine is still there for running instances after toggling the system theme. It still fixes itself when running |
Can you please share your lualine config? I haven’t been able to replicate this behaviour (yet 🙂) |
Will do! Might need a few days though, busy calendar ahead 🚢 |
I finally had time to look into this (sorry for the silence!). Turns out this was not an issue of cyberdream but default lualine behaviour. I just run the lualine setup function again after changing themes, this then resets the auto lualine theme and shows correct colors. |
Question or Suggestion
I'm currently using tokyonight and it automatically switches between day and night themes based on vim.o.background being dark or light. This is very helpful in combination with tools that switch colorschemes based on system preferences.
For example, I have a system daemon that sends SIGUSR1 to all running neovim instances and have this lua code that switches the vim background:
Cyberdream currently doesn't handle the color switch based on the background color. There now is a
CyberdreamToggleMode
vim cmd that toggles the theme that I can try to reimplement that in my lua code above to explicitly switch to dark or light colors, but ideally cyberdream could handle this on its own based on the vim.o.background value.The text was updated successfully, but these errors were encountered: