Kitty: Feature request: fast theme switcher

Created on 10 Jul 2019  路  4Comments  路  Source: kovidgoyal/kitty

For example for cases of switching between light and dark variants

Most helpful comment

I dont know what you mean by a fast theme switcher. Changing colors in kitty is instantaneous and if you enable remote control you can change colors in any arbitrary set fo kitty windows. https://sw.kovidgoyal.net/kitty/faq.html#how-do-i-change-the-colors-in-a-running-kitty-instance

All 4 comments

On macOS it could be possible to implement switching themes with the macOS dark mode setting.

Notice that kitty already allows switching themes with the remote control protocol. See https://github.com/dexpota/kitty-themes/blob/master/README.md#previews for a script that makes this easy.

I dont know what you mean by a fast theme switcher. Changing colors in kitty is instantaneous and if you enable remote control you can change colors in any arbitrary set fo kitty windows. https://sw.kovidgoyal.net/kitty/faq.html#how-do-i-change-the-colors-in-a-running-kitty-instance

@askobara It's quite easy to implement this yourself with kitty's set-colors. I've implemented it for fish shell here as a theme command:

https://github.com/ismay/dotfiles/blob/2f281e5fc7f16f5aad351c2040d64ff3d288092b/config/fish/functions/theme.fish

#!/usr/bin/env fish

function theme -d "Change kitty theme" -a theme_name
  # Do nothing if there is no theme specified
  if [ -z "$theme_name" ]
    return
  end

  # Path to search for theme conf files
  set -l theme_folder (command realpath ~/.dotfiles/themes/build)

  # Full path to theme
  set -l theme_path "$theme_folder/$theme_name.conf"

  # If theme exists, change theme
  if [ -e "$theme_path" ]
    # Change for current session
    kitty @ set-colors --all --configured $theme_path
  end
end

And it even autocompletes the themes I have available:

https://github.com/ismay/dotfiles/blob/2f281e5fc7f16f5aad351c2040d64ff3d288092b/config/fish/completions/theme.fish

#!/usr/bin/env fish

function theme_complete -d "Complete the theme command"
  # Only completes first argument
  if __fish_is_first_arg > /dev/null
    # Path to search for theme conf files
    set -l theme_folder (command realpath ~/.dotfiles/themes/build)

    for theme in $theme_folder/*.conf
      set -l theme_name (basename $theme .conf)
      echo $theme_name
    end
  end
end

complete -c theme -fk -a "(theme_complete)"

This is of course geared to my setup, but it should be very doable to adapt this your shell/workflow of choice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

drandreaskrueger picture drandreaskrueger  路  4Comments

jasminabasurita picture jasminabasurita  路  3Comments

JJGO picture JJGO  路  3Comments

hdriqi picture hdriqi  路  3Comments

bewzaalex picture bewzaalex  路  3Comments