olimorris / dotfiles

πŸ’» My personal dotfiles - utilising a sick Ruby Rakefile

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Auto switching Nvim colorscheme

idr4n opened this issue Β· comments

Hi there,

I just came to know your dotfiles through your neovim plugin "persited" πŸ‘πŸ». Planning to use it together with your awesome onedark theme.

I noticed that you have auto switching of color schemes in your entire environment in mac (terminal, editor etc,). I have something similar in mac but not as organized as yours. I followed basically 'Fatih Arslan' blog post on this and customized it for my own needs.

Recently I want to implement auto switching colorscheme in neovim as right now my config only detects the system appearance on startup, not on running instances of Neovim.

I noticed that you use the ToggleTheme function through your python script to send that command to every instance of neovim. I am trying to do something similar, however when using vim.cmd([[colorscheme light_theme]]) although the colorscheme does change, there are many colors that don't change though, specially lualine, gitsigns (as I have custom highlight groups for gitsigns), and some syntax highlighting that I think depends on treesitter.

I'm just wondering if you faced this issue as well at some point when using your ToggleTheme, and maybe if you can point me in the right direction on how to update all colors in those plugins, as well as custom highlight groups.

Thanks in advance!

commented

Hey @idr4n πŸ‘‹πŸΌ

there are many colors that don't change though, specially lualine, gitsigns (as I have custom highlight groups for gitsigns), and some syntax highlighting that I think depends on treesitter.

Yeah I had this exact same problem. I actually use a colorscheme autocmd, to work with this for my statusline. It essentially forces the whole statusline to reload. I recall that feline.nvim had a feature to allow you to reset the highlights so you may have something similar in lualine.

and maybe if you can point me in the right direction on how to update all colors in those plugins, as well as custom highlight groups

It might be how my onedarkpro.nvim theme works but issuing the vim.cmd([[colorscheme n]]) command also refreshes all of my custom highlights too.

Thanks a lot for answering that. I will take a look at heirline as it seems that it allows for reloading colors more easily than lualine, as per your colorscheme autocmd. I will also try with your onedarkpro theme to see how it goes.

Thanks a lot again and take care! πŸ‘‹πŸ»

commented

Heirline is amazing. One of my favourite plugins!!