Skip to content

Instantly share code, notes, and snippets.

@redthing1
Last active November 15, 2024 00:38
Show Gist options
  • Save redthing1/aabe3b7507683001baf7762df005890b to your computer and use it in GitHub Desktop.
Save redthing1/aabe3b7507683001baf7762df005890b to your computer and use it in GitHub Desktop.
convert xresources colors to kitty

xres to kitty

a quick converter to convert Xresources format color definitions (from terminal.sexy) to Kitty's color configuration format.

usage: ./xres_to_kitty.py < xres_colors.txt >> ~/.config/kitty/kitty.conf

ideally, you would clear the existing previously generated colors from the kitty conf file before running.

#!/usr/bin/env python3
from sys import stdin, stdout
import re
in_conf = stdin.read()
text = in_conf
text = re.sub('!', '#', text)
text = re.sub('\*.', '', text)
text = re.sub(':', '', text)
stdout.write(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment