(I'm not very good at naming things.) This Neovim plugin eases external scripting of colorscheme changing by allowing a file to control the colorscheme. It reads from the file on startup and also uses Neovim's libuv to watch for changes in that file and dynamically change the colorscheme.
However you like to install plugins
-- packer.nvim
use 'eriedaberrie/colorscheme-file.nvim'
" vim-plug
Plug 'eriedaberrie/colorscheme-file.nvim'
For a minimal setup, put the following snippet in your init.lua
. (If your
colorscheme has configuration, do that before running this because it loads the
colorscheme.)
require('colorscheme-file').setup()
The file used defaults to stdpath('data')/colorscheme-file
(~/.local/state/nvim/colorscheme-file
on Unix systems). From here, simply put
the desired theme name in the file and Neovim's colorscheme should change.
The following configuration options are available:
require('colorscheme-file').setup {
fallback = 'gruvbox', -- fallback colorscheme if the one in the file doesn't work
path = '/path/to/file', -- path to file (defaults to stdpath('data')/colorscheme-file)
silent = true, -- doesn't send error messages when enabled (defaults to false)
aliases = { -- table of strings that can be used in place of the full colorscheme name
cm = 'catppuccin-macchiato',
},
}