aboutsummaryrefslogtreecommitdiffstats
path: root/unix/termcolors2.bash
blob: def8b3e1718ae8f98f151a0cbb05a5c5b6c7a4f8 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
#
# Credits:
# [1] http://frexx.de/xterm-256-notes/data/colortable16.sh
# [2] https://wiki.archlinux.org/index.php/X_resources
#
# Modified by Aaron Griffin, and Kazuo Teramoto
#


FGNAMES=(' black ' '  red  ' ' green ' ' yellow' '  blue ' 'magenta' '  cyan ' ' white ')
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')
#echo "     ----------------------------------------------------------------------------"
echo "     ┌──────────────────────────────────────────────────────────────────────────┐"
for b in $(seq 0 8); do
    if [ "$b" -gt 0 ]; then
        bg=$(($b+39))
    fi

    #echo -en "\033[0m ${BGNAMES[$b]} : "
    echo -en "\033[0m ${BGNAMES[$b]} │ "

    for f in $(seq 0 7); do
        fg=$(($f+30))
        echo -en "\033[${bg}m\033[${fg}m ${FGNAMES[$f]} "
    done

    #echo -en "\033[0m :"
    #echo -en "\033[0m\n\033[0m     : "
    echo -en "\033[0m │"
    echo -en "\033[0m\n\033[0m     │ "

    for f in $(seq 0 7); do
        fg=$(($f+30))
        echo -en "\033[${bg}m\033[1;${fg}m ${FGNAMES[$f]} "
    done

    #echo -en "\033[0m :"
    echo -en "\033[0m │"
    echo -e "\033[0m"

  if [ "$b" -lt 8 ]; then
    #echo "     ----------------------------------------------------------------------------"
    echo "     ├──────────────────────────────────────────────────────────────────────────┤"
  fi
done
#echo "     ----------------------------------------------------------------------------"
echo "     └──────────────────────────────────────────────────────────────────────────┘"