How do I switch to specific colorscheme style on the fly?
Hi, so for example I have vim open with the "light" style and I want to switch to let's say "darker" or "warm". How do I do that? Not toggling but switching to specific style. It used to be possible to switch between light and dark by changing vim background from light do dark or vice versa, but that doesn't work anymore for some reason, so right now I'm using an older fork of your colorscheme where it still works: https://github.com/otakutyrant/onedark.nvim
I define a keymap to call require("onedark").toggle():
vim.keymap.set('n', '<leader>tc', '<CMD>lua require("onedark").toggle()<CR>')
And then add toggle_style_list to the plugin options. I use lazy:
{
'navarasu/onedark.nvim',
priority = 1000,
opts = {
style = 'cool',
toggle_style_list = { 'light', 'cool' },
},
init = function()
vim.cmd.colorscheme 'onedark'
end,
},
No need to change the vim background.
This is already supported! You can use the toggle_style_list option to switch between specific styles.
Add this to your config:
require('onedark').setup({
style = 'dark', -- your default style
toggle_style_key = '<leader>ts', -- keybinding to toggle
toggle_style_list = { 'light', 'darker', 'warm' }, -- styles to cycle through
})
Then pressing <leader>ts will cycle through light → darker → warm → light, etc.
You can also call require('onedark').toggle() programmatically from any keymap or command.
Closing as this feature already exists. Checking the README customization section for more examples!