2 # Author: Mike Frysinger <vapier@gmail.com>; released into the public domain; suck it.
6 # And this is the portable one.
13 GOOD="\$'${PREFIX}[32;01m'"
14 WARN="\$'${PREFIX}[33;01m'"
15 BAD="\$'${PREFIX}[31;01m'"
16 HILITE="\$'${PREFIX}[36;01m'"
17 BRACKET="\$'${PREFIX}[34;01m'"
18 NORMAL="\$'${PREFIX}[0m'"
20 for c in "${colors[@]}" ; do
21 [[ -t 0 ]] || c="${c%=*}="
27 if [[ ${TERM} != *-256color ]] ; then
29 echo "warning: TERM (${TERM}) does not end in '-256color';"
30 echo "warning: trying to use 256 colors might not work."
36 local col="${PREFIX}[${1};${2}m"
37 printf '%bthis color is: %s %b\n' "${col}" "${col}" "${PREFIX}[0m"
41 if [[ $1 == "--posix" ]] ; then
42 PREFIX=${POSIX_PREFIX}
51 for j in {30..37} ; do
58 for n in {16..231} ; do
59 showit "38;05" $(printf '%03i' ${n})
64 for n in {232..255} ; do
69 for x in system cube gray ; do
74 ncurses|curses|mutt|nano)
87 blackfg=$(tput setaf 0)
88 for seta in "af" "ab" ; do
89 [[ ${seta} == "af" ]] && ground=fore || ground=back
90 for pfx in "" "bright" ; do
91 for (( i = 0; i < ${#colors[@]}; ++i )) ; do
92 [[ ${pfx} == "bright" ]] && printf "${bold}"
93 [[ ${seta} == "ab" ]] && printf "${blackfg}"
94 echo "$(tput set${seta} ${i})this is ${ground}ground color '${pfx}${colors[i]}'${norm}"
101 usage: $0 [--posix] [colors]
104 - --env - show env you can eval in a shell
105 - 16, system - show basic colors (default)
106 - cube, 6x6x6 - show most extended colors
107 - gray - show gray scale
108 - all, 256 - show all colors
109 - curses - show ncurses color names (used by mutt, nano, etc...)