summaryrefslogtreecommitdiffstats
path: root/colorit
blob: 627d3102cc74d9c45615469e9c343dc231a9260f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/zsh
autoload -U colors
colors
#set -x
words="[email protected]"
: ${(A)elements:=${(z)words}}
while read LINE
do
   string=""
   #LINE="${LINE// /%}"
   #print $LINE
   for word in ${=LINE}
   do
        color="39"
        word=${(q)word}
        #set -x
        if (( ${+elements[(r)*(#i)$word*]} ));then
            temp=${elements[(r)$word:*]}
            if [[ $temp == *:* ]];then 
             color=${temp#*:}
            fi
            string+="%{%B%K{233}%F{$color}%}$word%{$reset_color%} "
        else
            string+="$word "
        fi
        #set +x
   done
  print -P $string
done
#set +x