Theme.sh Is An Interactive Terminal Theme Selection Script (400+ Themes)

theme.sh interactive terminal theme selector

theme.sh is a script to easily change the terminal theme. It comes with more than 400 themes, an optional interactive theme picker, and it's terminal agnostic.

The script is available as a single portable file that includes all the 400+ themes. It can set a terminal theme directly or, if you have fzf installed on your system, it provides a terminal menu for interactive theme selection, either in a preview pane, or directly as your terminal theme if the terminal you're using supports TRUECOLOR. You can also filter light and dark themes.

To use theme.sh, you need to use any terminal with OSC 4/11 support. This includes kitty, st, Terminal.app, iTerm2, alacritty, urxvt, st with a patch, and any libvte-based terminal like GNOME Terminal, Terminator, Guake, Xfce Terminal, Mate Terminal, Konsole, etc. It looks like Windows Terminal doesn't support this yet. Note that in my test, it didn't properly set the background color in Tilix. It's also worth noting that this won't work in screen.

This is the theme.sh interactive terminal theme selector in action (click the image to play the asciinema video):


theme.sh can also be easily used in scripts, with its developer providing examples for SSH integration (apply a theme for the duration of the current ssh command) and a sudo / su wrapper (set the theme to red-alert when su is used or the sudo command runs for more than 2 seconds).

Other features include a history of used themes (stored in ~/.theme_history by default), and the ability to add kitty themes to the script.

theme.sh is similar to Paleta, which we've covered a while back, with some differences though. theme.sh comes with more features and themes, while Paleta only allows changing the theme and that's it (no interactive theme selection UI, etc.). On the other hand, theme.sh doesn't change the colors on the fly for all running terminal emulators, and you must restart all terminals except for the one in which you've changed the theme (for which it does change the colors on the fly).

You might also like: A Quick Introduction To fzf (Interactive Command-Line Fuzzy Finder)


Install theme.sh


To download the theme.sh script and install it to /usr/local/bin, use:

wget https://raw.githubusercontent.com/lemnos/theme.sh/master/bin/theme.sh -O /tmp/theme.sh

sudo install /tmp/theme.sh /usr/local/bin

To use the interactive theme selection UI, you'll also need to install fzf.

Without any other configuration, the theme set using theme.sh is only used for the current terminal. When restarted (or if you open a new window), it uses the previous terminal theme. To apply the last selected theme to all new supported terminals, you need to edit your shell configuration file:

  • for Bash and Zsh, add the following code at the end of ~/.bashrc or ~/.zshrc (depending on what you're using):
if command -v theme.sh > /dev/null; then
    [ -e ~/.theme_history ] && theme.sh "$(theme.sh -l|tail -n1)"
fi

  • for Fish, add the following code at the end of the ~/.config/fish/config.fish file:
if type -q theme.sh
    if test -e ~/.theme_history
        theme.sh (theme.sh -l|tail -n1)
    end
end

See the theme.sh GitHub page for more options, scripting examples, etc.