Keeping terminal (kitty) colorscheme consistent with Neovim colorscheme

This is specific to kitty.

Depending on the time of day and room lighting I’ll cycle through a few variants of my colorscheme. I recently found a way to change my terminal colorscheme while in Neovim so they stay consistent.

local function set_terminal_colorscheme(name)
    vim.loop.spawn('kitty', {
        args = {
            -- '-a', -- update for all windows
            -- '-c', -- update for new windows
            string.format('~/.config/kitty/base16-kitty/colors/base16-%s.conf', name) -- path to kitty colorscheme
    }, nil)

Relevant kitty docs: Controlling kitty from scripts or the shell — kitty 0.19.3 documentation.

You’ll need the colorschemes for kitty in seperate files and the following line in your kitty.conf (assuming linux/mac):

listen_on unix:/tmp/mykitty

Or generate a kitty colorscheme from your vim colorscheme :slight_smile: