#!/bin/sh
# <BEGIN COPYRIGHT>
# This file is part of the "Bad Penguin" GNU/Linux distribution
# Copyright (C) 1997-98-99 by Antonio GALLO
# Home Page at ......: http://www.badpenguin.org
# Home Page at ......: http://www.linux.it/~agx/
# e-mail contact ....: mailto:agx@linux.it	mailto:agx@geocities.com
# This program is distributed under the GNU General Public License
# You are not allowed to remove the copyright notice
# <END COPYRIGHT>

# Color shell facility
# 1.0.0 by agx@linux.it 
if [ "$TERM" = "linux" -o "$TERM" = "xterm" -o "$TERM" = "rxvt" -o "$TERM" = "xterm-color" ]; then
    # Default Color is white
    DEFAULT_COLOR="\033[0;37m"
    case "$1" in
	GREEN|green)
	    echo -n -e "\033[1;32m"
    	    ;;
	CYAN|cyan) 
	    echo -n -e "\033[1;36m"
	    ;;	
        RED|red)
	    echo -n -e "\033[1;31m"
	    ;;	
	YELLOW|yellow)
	    echo -n -e "\033[1;33m"
	    ;;
	WHITE|white)
	    echo -n -e "\033[0;37m"
	    ;;	
	BLACK|black)
	    echo -n -e "\033[0;30m"
	    ;;
	BLUE|blue)
	    echo -n -e "\033[1;34m"
	    ;;	
	GREY|grey)
	    echo -n -e "\033[1;30m"
	    ;;
	PURPLE|purple)
	    echo -n -e "\033[1;35m"
	    ;;
    esac
    # Print Argument
    shift
    if [ "$1" = "-n" ]; then
      shift
      echo -n "$*"    
    else
      echo "$*"    
    fi
    # Restore Default Color
    echo -n -e $DEFAULT_COLOR
else
    # Ignore colors silently
    shift
    if [ "$1" = "-n" ]; then
      shift
      echo -n "$*"    
    else
      echo "$*"    
    fi
fi 
