2 # | |--. ,--. --.-. ,--.
3 # | | | |--' | | | |--'
4 # ' ' ' `--' ' ' ' `--' 2016-10-27
5 #_______________________________________________________________________________
7 # Set a x-ressource theme to the tty
9 # Set the directory where you usually set your themes:
10 THEMES="$HOME/.config/themes"
12 # Then run this script, with either one theme name as argument, or as is, to
13 # run it in an interactively filter. You can set the filter to something like
14 # fzf, fzy, slmenu, pick, pick, selecta...
20 # interactively prompt for a color theme
21 ls "$THEMES" | $FILTER
23 # otherwise use the one from the command line argument
25 fi | xargs -i sed -rn '
27 # remove comment lines
33 # convert colors numbers from decimal to hexadecimal
41 # print escaped color names
42 s/.*\.color([0-9A-F])[[:space:]]*:[[:space:]]*#/\1/ p
44 ' "$THEMES/{}" | while read color
46 # TTY color escape codes
47 printf '\033]P%s' "$color"