Skip to content

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

There are only 2 simple steps to change colorscheme of your editor:

  1. Add a plugin
  2. Specify colorscheme

Step 1 - Adding a plugin

You can either add a colorscheme plugin directly to your plugins as described in the Custom Plugins Page, for example if you wanted to add Catppuccin you would add the following to your plugins:

{
"catppuccin/nvim",
name = "catppuccin",
opts = {
-- configuration options...
},
}

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 necessary import statement as described in the AstroCommunity documentation. For example to add Catppuccin, you would add the following to your plugins:

"AstroNvim/astrocommunity",
{ import = "astrocommunity.colorscheme.catppuccin" }

Step 2 - Specifying colorscheme

Open your user/init.lua (usually it’s ~/.config/nvim/lua/user/init.lua), find the line where colorsheme property is being set:

colorscheme = "astrodark"

Then change it to the name of the theme you’ve installed in the step 1:

colorscheme = "catppuccin"

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:

return {
colorscheme = "sonokai",
plugins = {
{
"sainnhe/sonokai",
init = function() -- init function runs before the plugin is loaded
vim.g.sonokai_style = "shusia"
end,
},
},
}