Use which-key.nvim bindings to cycle between your colorschemes.
https://github.com/user-attachments/assets/c098edd7-fc92-45e4-9312-cecf9f222428
Requirements:
which-key.nvimfolke/lazy.nvim is highly recommended to install this plugin!
IMPORTANT: Load which-key.nvim and all your colorschemes BEFORE you load this plugin!
{
'DrKJeff16/which-colorscheme.nvim',
event = 'VeryLazy', -- IMPORTANT
dependencies = { 'folke/which-key.nvim' },
opts = {},
}
You can also install this through LuaRocks:
luarocks install which-colorscheme.nvim # Global install
luarocks install --local which-colorscheme.nvim # Local install
The default setup options are the following:
{
prefix = '<leader>C', -- The prefix to your keymap
group_name = 'Colorschemes', -- The prefix group in `which-key.nvim`
include_builtin = false, -- Whether to include the built-in Neovim colorschemes
-- NOTE: If `custom_groups` is empty this will be ignored
custom_only = false, -- Whether to only map the colorschemes defined in `custom_groups`
custom_groups = {}, -- Custom groups for colorschemes (see the `Custom Groups` section below)
excluded = {}, -- List of colorscheme names/variants to ignore
grouping = {
labels = {}, -- The labels assigned to a given group (see the `Labeling` section below)
uppercase_groups = false, -- Whether to use uppercase groups for keymaps
random = false, -- Whether to randomize the mappings
inverse = false, -- Whether to map your colorschemes from z-a (if random is `true`, this does nothing)
current_first = true, -- Whether to put the current colorscheme in the first group
},
}
https://github.com/user-attachments/assets/53e72f8e-71cc-4cf8-9a6c-5927b3fb7fad
If you wish to order your colorschemes manually you can use the custom_groups option:
require('which-colorscheme').setup({
custom_groups = {
A = { 'tokyonight', 'tokyonight-storm', 'tokyonight-moon', 'tokyonight-night', 'tokyonight-day' },
-- Skip section B
C = { '', 'catppuccin' }, -- Blank strings are ignored
D = { 'foo' }, -- If `foo` is not a colorscheme it'll get skipped
},
})
You can add custom group names to any desired group section:
require('which-colorscheme').setup({
grouping = {
labels = {
A = 'Favorites',
B = '', -- The default `B` group name will be used
C = ' ', -- The default `C` group name will be used
E = 'Extras', -- The `D` group will fall back to its default value
F = ' Foo ', -- Will be stripped down to `Foo`
},
},
})
You can ignore any colorscheme variant you'd like. For example, let's say we want to ignore the light colorscheme variants, plus some built-in ones:
require('which-colorscheme').setup({
excluded = {
-- Built-in
'blue',
'darkblue',
-- tokyonight
'tokyonight-day',
-- catppuccin
'catppuccin-latte',
-- nightfox
'dawnfox',
'dayfox',
-- kanagawa
'kanagawa-lotus',
-- teide
'teide-light',
},
})
Note that you'll need to know the name of the colorscheme to begin with
(the one you use in the :colorscheme command).
You can see all the colorschemes listed either by using a picker that supports it
(e.g. :Telescope colorscheme for telescope).
Alternatively you can run this in your command line:
" This will print out all the installed colorschemes
:lua vim.print(vim.fn.getcompletion('', 'color'))