#!/usr/bin/ksh
# colour_chart_big.sh - Author: Edwin Arneson - $Revision: 1.1 $ - $Date: 2001-03-23 12:59:22-08 $
#	Q&D script to print out a bunch of hex code for use with HTML "COLOR" tags.
#	This script will only display 262144 out of 16777216 possible colours, but it
#	is a representative sample.
# FORMAT:	colour_chart_big.sh
# CALLED BY:
#	/u02/help_desk/docs/shdesk/sys_support/sysdocs.html
# CHANGE HISTORY:
#	010323 EJA 1.1	- Created
# RCS INFORMATION:
#         $Id: colour_chart_big.sh,v 1.1 2001-03-23 12:59:22-08 earneson Exp $
#     $Author: earneson $
#       $Date: 2001-03-23 12:59:22-08 $
#   $Revision: 1.1 $
#     $Source: /u02/help_desk/cgi-bin/shdesk/sys_support/RCS/colour_chart_big.sh,v $
#      $State: Exp $

#######
####### Initialization
#######
# Special check for first parameter of "-x" to turn on tracing of the script execution
if [[ "$1" = "-x" ]] ; then
	set -x
fi

if [[ -r /export/home/earneson/bin/localize ]] ; then
	. /export/home/earneson/bin/localize
	ejadir=/export/home/earneson
elif [[ -r /home/earneson/bin/localize ]] ; then
	. /home/earneson/bin/localize
	ejadir=/home/earneson
elif [[ -r /earneson/bin/localize ]] ; then
	. /earneson/bin/localize
	ejadir=/earneson
elif [[ -r /Users/earneson/bin/localize ]] ; then
	. /Users/earneson/bin/localize
	ejadir=/Users/earneson/bin
elif [[ -r /export/home/appbin/localize ]] ; then
	. /export/home/appbin/localize
	ejadir=/export/home/appbin
fi
# Ensure these two are set
if [[ -z "$localhost" ]] ; then
	localhost=`uname -n`
	export localhost
fi
if [[ -z "$awkname" ]] ; then
	awkname=nawk
	export awkname
fi
#######
####### Functions
#######

#######
####### Other variables
#######
basename=`basename $0`
USAGE="$basename
usage: $basename"
debuglevel=0	# default debugging level

#######
####### Parse parameters.
#######
while getopts :xXz optchar ; do
	if [ $debuglevel -ge 1 ] ; then echo ">optchar=$optchar< >OPTARG=$OPTARG> >OPTIND=$OPTIND<" ; fi
	case $optchar in
		x)	set -x ;;
		X)  let "debuglevel=$debuglevel + 1" ;;
		z)	echo "$USAGE" >&2
			exit 56
			;;
		*)	if [ -z "$OPTARG" ] ; then
				case "$optchar" in
					?)	errflag="-$optchar" ;;
					+?)	errflag="$optchar" ;;
					*)	errflag="unknown1" ;;
				esac
			else
				errflag="$OPTARG"
			fi
			echo "ERROR 51 - Unknown option >$errflag<" >&2
			echo "$USAGE" >&2
			exit 51
			;;
	esac
done
shift `expr $OPTIND - 1`

#######
####### Additional checks
#######

#######
####### Main processing
#######
echo $echoflag "Content-type: text/html\n\n"
echo $echoflag "<HTML>"
echo $echoflag "<BODY>"
echo $echoflag "<TT>"

for r1 in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do
for r2 in 0 4 8 C ; do
	for g1 in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do
	for g2 in 0 4 8 C ; do
		echo $echoflag "<BR>"
		for b1 in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do
		for b2 in 0 4 8 C ; do
			echo $echoflag "<FONT COLOR=\"#$r1$r2$g1$g2$b1$b2\"> $r1$r2$g1$g2$b1$b2 </FONT>\c"
		done
		done
	done
	done
done
done

echo $echoflag "<BR>"
echo $echoflag "</TT>"
echo $echoflag "</BODY>"
echo $echoflag "</HTML>"

#######
####### The end.
#######
exit
