:Colorscheme
: Open a menu to preview and select a colorscheme:ColorschemeToggle
: Switch between your preferred dark and light colorschemes
With lazy.nvim:
-- plugins.lua
return {
"spenserblack/colorscheme.nvim",
-- ...
}
If you install with lazy.nvim these should be handled automatically, but if you use another package manager then you may need to manually install these dependencies.
Through the setup
function, you can pass the settings preferred_dark_colorscheme
,
preferred_light_colorscheme
, and theme_mode
. The preferred colorschemes should be
names of one of the available colorschemes. theme_mode
can be one of the following:
dark
light
system
When the theme_mode
is system
, this plugin will do its best to guess your system's
preferred colors. This will be determined when the plugin first starts up and needs to
query the preferred theme.
If theme_mode
fails to detect an appropriate theme, you can use theme_mode_fallback
to specify a value that should be used instead. This is only relevant when
theme_mode
is set to "system"
. theme_mode_fallback
should be either "dark"
or
"light"
.
NOTE: If you want to dynamically change the colorscheme's background,
you may not need this plugin. Neovim should set your background
option based on the
background of your terminal. This is different from querying the system theme, but this
might be good enough for you. Some colorschemes have both a dark and light mode.
WARNING: Detecting the system theme currently only works on Windows and Linux with a GNOME DE. Any help to expand support is appreciated.
require("colorscheme").setup({
preferred_dark_colorscheme = "habamax",
preferred_light_colorscheme = "default",
theme_mode = "system",
theme_mode_fallback = "dark",
})
This plugin comes with a default list of selectable colorschemes, based on the defaults that come with Neovim 0.10.1. Unfortunately, if you add your own custom colorscheme, this plugin will not be aware of it. This is because this plugin currently doesn't know if it should put your colorscheme under the "dark", "light", or "neutral" colorscheme sections.
There are several helper functions to allow you to manage the known colorschemes.
-- For each of these, there is a dark/light/neutral counterpart
require("colorscheme").add_dark_colorscheme("black")
require("colorscheme").remove_light_colorscheme("default")
require("colorscheme").set_neutral_colorschemes({ "red", "green", "blue" })