#!/bin/sh # # Display XTERM, ANSI or VT102 colours. # #e=$'\e' # BASH escape character e=`echo | tr '\012' '\033'` # escape character E="$e[" # escape sequence echo "${E}m Display XTERM, ANSI or VT102 colours." echo " {ESC}[{arg};{arg};{arg}m as many arguments as you like" echo " Attributes: set=0-7 unset=20-27 (WARNING: 22 for unbold)" echo " normal=0 bold=1 underline=4 link=5 invert=7 invisible=8" echo " Color: black=0, red, green, yellow, blue, magenta, cyan, white=7" echo " foreground=30-37 background=40-47" echo " high_intensity_fg=90-97 high_intensity_bg=100-107" echo " No arguments is equivelent to using 0 for normal" echo "" echo "Examples :-" echo " ${E}31;43m red on yellow(43) ${E}0m reset to normal(0)" echo " ${E}0;31;40m red(31) on black(40) ${E}m" echo " ${E}91m high_int(91) ${E}31m red_fg(31)${E}m" echo " ${E}31;1m bold(1) ${E}22m un-bold(22)${E}m <- it is 22 not 21!" echo " ${E}31;7m invert(7) ${E}27m un-invert(27)${E}m" echo " ${E}31;4m underline(4) ${E}24m un-underline(24)${E}m" echo " ${E}31;8m invisible(8) ${E}28m un-invisible(28)${E}m <- 8 to hide" echo "" echo "Color Table :-" echo \ "Fore \ Back 40 41 42 43 44 45 46 47" for fg in 30 31 32 33 34 35 36 37; do hi="${fg/3/9}" # convert forground to high_intensity line1=" $fg " line2=" " line3=" " #line4=" " for bg in 40 41 42 43 44 45 46 47; do line1="${line1} ${E}${fg};${bg}m Normal ${E}m" line2="${line2} ${E}${hi};${bg}m HiInt ${E}m" line3="${line3} ${E}${fg};${bg};1m Bold ${E}m" #line4="${line4} ${E}${hi};${bg};1m HIBold ${E}0m" done echo "$line1" echo "$line2" echo "$line3" #echo "$line4" done cat - <