Search This Blog

Showing posts with label tput. Show all posts
Showing posts with label tput. Show all posts

Thursday, July 8, 2010

Color Combination used in script.

To make the script more user friendly I have decided to add some colors in output.

3 Basic colors are used in showing the output.

1)Green. (echo -e "\033[32m Hello World")
2)Red. (echo -e "\033[31m Hello World")
3)White. (The "tput sgr0" restores the terminal settings to normal.)

conventions
Green : Command used for execution
Red : User Input
White : Output./Notes


**************************************
More options

BGGREEN=`echo "\033[42m"` # background to green
BGCYAN=`echo "\033[45m"` # background to cyan
BGWHITE=`echo "\033[47m"` # background to white
FGBLACK=`echo "\033[30m"` # foreground to black
FGRED=`echo "\033[31m"` # foreground to red
BGBLACK=`echo "\033[40m"` # background to black
FGGREEN=`echo "\033[32m"` # foreground to green
BGWHITEFGBLUE=`echo "\033[91m"` # background to white & foreground to blue
#BGWHITEFGBLUE=`echo "\033[94m"` # background to white & foreground to blue
BGWHITEFGMAGENTA=`echo "\033[95m"` # background to white & fg to magenta
BGYELLOW=`echo "\033[43m"` # background to yellow
FGBLUE=`echo "\033[34m"` # foreground to blue
FGMAGENTA=`echo "\033[35m"` # foreground to magenta
FGCYAN=`echo "\033[36m"` # foreground to cyan
BGBLUE=`echo "\033[44m"` # background to blue
BGRED=`echo "\033[41m"` # background to red
FGWHITE=`echo "\033[37m"` # foreground to white
BGCYAN=`echo "\033[45m"` # background to cyan
BLINK=`echo "\033[5m"` #terminal to blink
NORMAL=`echo "\033[m"` #terminal to normal
UNDERLINE=`echo "\033[4m"` #terminal to underline
NOUNDERLINE=`echo "\033[24m"` #terminal to cancel underline
REVERSE=`echo "\033[7m"` #terminal to reverse video
BGMAGENTA=`echo "\033[45m"` # background to magenta
BOLD=`echo "\033[1m"` #bold

Click on image to see high resolution version of it.

For more detailed tput information please go through this informative article.
http://www.thegeekstuff.com/2011/01/tput-command-examples/?utm_source=feedburner&utm_medium=email&utm_campaign=Feed%3A+TheGeekStuff+%28The+Geek+Stuff%29