]> Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/colortable
bin/colortable: Rewrite in bash, columns for background colors
[dotfiles.git] / bin / colortable
1 #!/bin/bash
2 # Usage: colortable
3 #
4 # Print a color table of ANSI colors (normal+bright) to demonstrate what
5 # colors are available. Each line is the color code of one foreground
6 # color, out of 17 (default + 16 escapes), followed by a test use of that
7 # color on all nine background colors (default + 8 escapes).
8 #
9 # (Based on: http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html)
10
11 T='gYw' # The test text
12
13 # Standard background colors
14 echo -e "\n 40m 41m 42m 43m 44m 45m 46m 47m";
15 for FGs in ' m' ' 1m' \
16 ' 30m' ' 90m' '1;30m' \
17 ' 31m' ' 91m' '1;31m' \
18 ' 32m' ' 92m' '1;32m' \
19 ' 33m' ' 93m' '1;33m' \
20 ' 34m' ' 94m' '1;34m' \
21 ' 35m' ' 95m' '1;35m' \
22 ' 36m' ' 96m' '1;36m' \
23 ' 37m' ' 97m' '1;37m'; do
24 FG=${FGs// /}
25 echo -en " $FGs \033[$FG $T \033[0m"
26 for BG in 40m 41m 42m 43m 44m 45m 46m 47m; do
27 echo -en " \033[$FG\033[$BG $T \033[0m";
28 done
29 echo;
30 done
31
32 # Bright background colors
33 echo -e "\n 100m 101m 102m 103m 104m 105m 106m 107m";
34 for FGs in ' m' ' 1m' \
35 ' 30m' ' 90m' '1;30m' \
36 ' 31m' ' 91m' '1;31m' \
37 ' 32m' ' 92m' '1;32m' \
38 ' 33m' ' 93m' '1;33m' \
39 ' 34m' ' 94m' '1;34m' \
40 ' 35m' ' 95m' '1;35m' \
41 ' 36m' ' 96m' '1;36m' \
42 ' 37m' ' 97m' '1;37m'; do
43 FG=${FGs// /}
44 echo -en " $FGs \033[$FG $T \033[0m"
45 for BG in 100m 101m 102m 103m 104m 105m 106m 107m; do
46 echo -en " \033[$FG\033[$BG $T \033[0m";
47 done
48 echo;
49 done
50 echo