3 # Zsh Theme Chooser by fox (fox91 at anche dot no)
4 # This program is free software. It comes without any warranty, to
5 # the extent permitted by applicable law. You can redistribute it
6 # and/or modify it under the terms of the Do What The Fuck You Want
7 # To Public License, Version 2, as published by Sam Hocevar. See
8 # http://www.wtfpl.net/txt/copying/ for more details.
10 THEMES_DIR="$ZSH/themes"
11 FAVLIST="${HOME}/.zsh_favlist"
12 source $ZSH/oh-my-zsh.sh
16 if [[ $a == "N" || $a == "n" || $a = "" ]]; then
22 function theme_preview() {
24 THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//`
25 print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color"
26 source "$THEMES_DIR/$THEME"
29 print -P "$PROMPT $RPROMPT"
34 echo "
\e[0;1;35;95m╺━
\e[0;1;31;91m┓┏
\e[0;1;33;93m━┓
\e[0;1;32;92m╻
\e[0m
\e[0;1;36;96m╻
\e[0m
\e[0;1;35;95m╺┳
\e[0;1;31;91m╸╻
\e[0m
\e[0;1;33;93m╻
\e[0;1;32;92m┏━
\e[0;1;36;96m╸┏
\e[0;1;34;94m┳┓
\e[0;1;35;95m┏━
\e[0;1;31;91m╸
\e[0m
\e[0;1;32;92m┏━
\e[0;1;36;96m╸╻
\e[0m
\e[0;1;34;94m╻
\e[0;1;35;95m┏━
\e[0;1;31;91m┓┏
\e[0;1;33;93m━┓
\e[0;1;32;92m┏━
\e[0;1;36;96m┓┏
\e[0;1;34;94m━╸
\e[0;1;35;95m┏━
\e[0;1;31;91m┓
\e[0m"
35 echo "
\e[0;1;31;91m┏━
\e[0;1;33;93m┛┗
\e[0;1;32;92m━┓
\e[0;1;36;96m┣━
\e[0;1;34;94m┫
\e[0m
\e[0;1;31;91m┃
\e[0m
\e[0;1;33;93m┣
\e[0;1;32;92m━┫
\e[0;1;36;96m┣╸
\e[0m
\e[0;1;34;94m┃
\e[0;1;35;95m┃┃
\e[0;1;31;91m┣╸
\e[0m
\e[0;1;36;96m┃
\e[0m
\e[0;1;34;94m┣
\e[0;1;35;95m━┫
\e[0;1;31;91m┃
\e[0m
\e[0;1;33;93m┃┃
\e[0m
\e[0;1;32;92m┃
\e[0;1;36;96m┗━
\e[0;1;34;94m┓┣
\e[0;1;35;95m╸
\e[0m
\e[0;1;31;91m┣┳
\e[0;1;33;93m┛
\e[0m"
36 echo "
\e[0;1;33;93m┗━
\e[0;1;32;92m╸┗
\e[0;1;36;96m━┛
\e[0;1;34;94m╹
\e[0m
\e[0;1;35;95m╹
\e[0m
\e[0;1;33;93m╹
\e[0m
\e[0;1;32;92m╹
\e[0m
\e[0;1;36;96m╹
\e[0;1;34;94m┗━
\e[0;1;35;95m╸╹
\e[0m
\e[0;1;31;91m╹
\e[0;1;33;93m┗━
\e[0;1;32;92m╸
\e[0m
\e[0;1;34;94m┗━
\e[0;1;35;95m╸╹
\e[0m
\e[0;1;31;91m╹
\e[0;1;33;93m┗━
\e[0;1;32;92m┛┗
\e[0;1;36;96m━┛
\e[0;1;34;94m┗━
\e[0;1;35;95m┛┗
\e[0;1;31;91m━╸
\e[0;1;33;93m╹┗
\e[0;1;32;92m╸
\e[0m"
41 echo "Usage: $0 [options] [theme]"
44 echo " -l List available themes"
45 echo " -s Show all themes"
46 echo " -h Get this help message"
50 function list_themes() {
51 for THEME in $(ls $THEMES_DIR); do
52 THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//`
57 function insert_favlist() {
58 if grep -q "$THEME_NAME" $FAVLIST 2> /dev/null ; then
59 echo "Already in favlist"
61 echo $THEME_NAME >> $FAVLIST
62 echo "Saved to favlist"
67 function theme_chooser() {
68 for THEME in $(ls $THEMES_DIR); do
73 noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \
74 insert_favlist $THEME_NAME
80 while getopts ":lhs" Option
84 s ) theme_chooser 0 ;;
86 * ) usage ;; # Default.
90 if [[ -z $Option ]]; then
96 theme_preview $1".zsh-theme"