Custom Colorscheme/Theme
This page goes over how to install and configure a custom color scheme or theme in your AstroNvim configuration. By default AstroNvim ships with it’s own custom color scheme, AstroTheme, but there are many others to choose from to fit your needs. When choosing a colorscheme/theme, make sure to check what plugins they support and compare that with the list of Plugins used in AstroNvim. Not every plugin requires custom highlights, but having good support for common plugins helps unify the user interface and keep things looking nice.
Using a Custom Colorscheme
-
Add the colorscheme plugin
You can either add a colorscheme plugin directly to your
plugins
as described in the Customizing Plugins Page, for example if you wanted to add Catppuccin you would add the following to yourplugins
:Or you can install it using AstroCommunity. Navigate to the folder listing the available community colorscheme plugins and pick a colorscheme that you would like to install. Then make sure you have add the AstroCommunity repository to your
plugins
and then insert the necessaryimport
statement as described in the AstroCommunity documentation. For example to add Catppuccin, you would add the following to yourplugins
: -
Configure AstroUI to set the colorscheme
The default colorscheme for AstroNvim can be configured through the AstroUI plugin with the
colorscheme
option. This can be added to your user configuration’s plugins:Then change it to the name of the theme you’ve installed in the step 1:
Using a Custom Colorscheme Configured with Global Variables
Some colorscheme plugins are configured through global variables rather than Lua functions like setup()
so they require a slightly different setup to get them working correctly. For example if we want to use Sonokai:
Cache colorscheme
Some users may want to persist the last chosen colorscheme rather than always using the value set in their user configuration on startup. This can be easily implemented within your plugin configuration with the following code: