2 # $XTermId: 16colors.sh,v 1.13 2003/05/19 00:52:30 tom Exp $
3 # -----------------------------------------------------------------------------
4 # this file is part of xterm
6 # Copyright 1999-2002,2003 by Thomas E. Dickey
10 # Permission is hereby granted, free of charge, to any person obtaining a
11 # copy of this software and associated documentation files (the
12 # "Software"), to deal in the Software without restriction, including
13 # without limitation the rights to use, copy, modify, merge, publish,
14 # distribute, sublicense, and/or sell copies of the Software, and to
15 # permit persons to whom the Software is furnished to do so, subject to
16 # the following conditions:
18 # The above copyright notice and this permission notice shall be included
19 # in all copies or substantial portions of the Software.
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 # IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
25 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 # Except as contained in this notice, the name(s) of the above copyright
30 # holders shall not be used in advertising or otherwise to promote the
31 # sale, use or other dealings in this Software without prior written
33 # -----------------------------------------------------------------------------
34 # Show a simple 16-color test pattern. It is a little more confusing than
35 # 8colors.sh, since everything is abbreviated to fit on an 80-column line.
36 # The high (8-15) combinations for foreground or background are marked with
44 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
45 ( test ! -f $TMP || test -s $TMP ) &&
46 for verb in printf print ; do
48 eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
49 if test -f $TMP ; then
50 if test ! -s $TMP ; then
60 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
62 trap '$CMD "
\e[0m"; exit' EXIT HUP INT TRAP TERM
64 trap '$CMD "
\e[0m"; exit' 0 1 2 5 15
78 for FG in 0 1 2 3 4 5 6 7
92 if test $HI = 3 ; then
97 $CMD $OPT "
\e[0;${AT}m$attr$SUF"
98 $CMD $OPT "
\e[${HI}${FG}m$color$SUF"
99 for BG in 1 2 3 4 5 6 7
111 $CMD $OPT "
\e[4${BG}m$bcolor$SUF"
112 $CMD $OPT "
\e[10${BG}m+$bcolor$SUF"