Script to try various themes from kitty terminal

2019-12-16 1 min read bash Learning

Here is the script. Very simple yet very useful script.

#!/bin/bash - 
#===============================================================================
#
#          FILE: kitty-theme.sh
# 
#         USAGE: ./kitty-theme.sh 
# 
#   DESCRIPTION: 
# 
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka),
#  ORGANIZATION: Individual
#       CREATED: 12/06/2019 10:15
# Last modified: Fri Dec 06, 2019  10:41AM
#      REVISION:  ---
#===============================================================================

set -o nounset                              # Treat unset variables as an error

FOLDER="/git/terminal.sexy/dist/schemes"  ### This is git folder where you have terminal.sexy cloned

if [[ ! -d $FOLDER ]]
then
    cd $FOLDER/../../../
    git clone https://github.com/stayradiated/terminal.sexy

fi

cd $FOLDER
tmp=$(mktemp /tmp/color-XXXXXXXX)
echo $tmp
files=$(find . -type f -name \*json)
for line in $(echo ${files[*]})
do
    echo "Processing $line"
    >$tmp
    echo "# From $line.. processed by Amit Agarwal script" >> $tmp
    sed -n -e '/color/,/\],/ p' $line | sed -e 1d -e '$d'| \
        sed 's/[",]//g'|awk '{count++; print "color"count"\t "$1}' >> $tmp
    grep ground $line |sed 's/^ *//' |sed 's/[":,]//g' >> $tmp

    kitty @ set-colors -a $tmp

    ls --color=auto ~
    read -p "If you like the theme, just press l ::" test
    if [[ $test == "l" ]]
    then
        rm -f ~/.config/kitty/theme.conf
        cp $tmp ~/.config/kitty/theme.conf
    fi
done
rm -f $tmp
comments powered by Disqus