Skip to main content

Themes and Hints Kittens

The themes and hints kittens solve two common needs: changing color schemes without editing config, and selecting visible text without using the mouse.

Learning Focus

Learn to switch color themes interactively and use hint-based text selection to open URLs, copy paths, and build custom actions.

Themes Kitten

The themes kitten lets you browse, preview, and apply color themes interactively.

Basic Usage

# Open the interactive theme browser
kitty +kitten themes

A TUI opens showing available themes grouped by category. Navigate with arrow keys, preview with Enter, and apply with Ctrl+c.

What You Can Do

ActionHow
Browse themesArrow keys to scroll
Preview themeHighlight and press Enter
Apply themePress Ctrl+c on selected
Set as defaultAnswer "yes" when prompted
Search themesType to filter
View theme sourceMouse-over shows source URL

Theme Storage

Applied themes are written to kitty.conf:

# The themes kitten adds or updates this line:
include themes/mytheme.conf

Themes are stored in ~/.config/kitty/themes/.

Creating a Custom Theme

Create a .conf file in ~/.config/kitty/themes/:

~/.config/kitty/themes/my-custom-theme.conf
# My Custom Theme
foreground #dcdcdc
background #1a1b26
selection_foreground #ffffff
selection_background #7aa2f7

# Black
color0 #1d2021
color8 #928374

# Red
color1 #cc241d
color9 #fb4934

# Green
color2 #98971a
color10 #b8bb26

# Yellow
color3 #d79921
color11 #fabd2f

# Blue
color4 #458588
color12 #83a598

# Magenta
color5 #b16286
color13 #d3869b

# Cyan
color6 #689d6a
color14 #8ec07c

# White
color7 #a89984
color15 #ebdbb2

Then apply it:

kitty +kitten themes
# Search for "my-custom-theme" and select it

Automatic Light/Dark Switching

Use a cron job or systemd timer:

~/.local/bin/kitty-theme-switch.sh
#!/bin/bash
HOUR=$(date +%H)
THEME_DIR="$HOME/.config/kitty/themes"

if [ "$HOUR" -ge 6 ] && [ "$HOUR" -lt 18 ]; then
THEME="catppuccin-latte.conf" # light
else
THEME="catppuccin-mocha.conf" # dark
fi

kitty @ set-colors --all "$THEME_DIR/$THEME"

Hints Kitten

The hints kitten selects visible text by matching patterns. It overlays each match with a keyboard shortcut, letting you act on it.

Basic Usage

# Select a URL from visible terminal output
kitty +kitten hints

# Select a file path
kitty +kitten hints --type path

# Select any text matching a regex
kitty +kitten hints --customize '[A-Z]+_\d+' --program 'echo {}'

# Open the selected text with a program
kitty +kitten hints --type path --program vim
How Hints Work

The kitten parses all visible text, finds matches for the pattern, assigns each a keyboard shortcut, and lets you press that shortcut to act on the match.

Hint Types

TypeMatchesDefault Action
urlHTTP/HTTPS/FTP URLsOpen in browser
pathFile system pathsOpen path
hashGit commit hashesCopy hash
lineAny line of textCopy line
wordAny wordCopy word
numericNumbersCopy number
hyperlinkOSC 8 hyperlinksOpen hyperlink

Custom Hint Patterns

# Match IP addresses and pipe to clipboard
kitty +kitten hints --customize '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' --program 'xclip -selection clipboard'

# Match error codes and open docs
kitty +kitten hints --customize 'E[0-9]{4}' --program 'open "https://example.com/errors/{}"'

# Match Docker container IDs
kitty +kitten hints --customize '[a-f0-9]{12}' --program 'docker inspect {}'

Hints Configuration in kitty.conf

~/.config/kitty/kitty.conf
# Map hint kitten to a shortcut
map ctrl+shift+u kitten hints --type url
map ctrl+shift+p kitten hints --type path --program vim
map ctrl+shift+y kitten hints --type line

Hyperlinked Grep

The hyperlinked_grep kitten combines grep with clickable results:

# Search files and get clickable results
kitty +kitten hyperlinked_grep "search_term" /path/to/search

# With file type filter
kitty +kitten hyperlinked_grep --include '*.py' "def class" /src

# Case-insensitive search
kitty +kitten hyperlinked_grep -i "error" /var/log

Each result line is clickable — press the hinted key to open the file at the matching line.

Common Pitfalls

PitfallSymptomFix
Themes kitten shows no themesEmpty listInstall theme collections or run kitty +kitten themes from a writable dir
Hint matches too many itemsOverlapping keyboard shortcutsNarrow the regex or use --type with a specific type
Hints not matching pathsPaths with spaces or special charsUse --customize with an escaped regex
Hyperlinked grep very slowLarge search spaceAdd --include or --exclude to limit scope
Theme not persisting after restartTheme not saved to configWhen prompted "Set as default?", answer "yes"

Hands-On Practice

# Browse and apply a theme
kitty +kitten themes

# Practice hints on visible URLs
echo "Visit https://example.com and https://kitty.app for more info"
# Now run: kitty +kitten hints --type url
# Press the displayed key to open a URL

# Custom hint for hex colors
echo "Colors: #ff5733 #33ff57 #3357ff"
kitty +kitten hints --customize '#[0-9a-fA-F]{6}' --program 'echo "Selected: {}"'

# Hyperlinked grep
mkdir -p /tmp/testgrep
echo -e "line one\nerror: something broke\nline three" > /tmp/testgrep/test.log
kitty +kitten hyperlinked_grep "error" /tmp/testgrep
rm -rf /tmp/testgrep

What's Next