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