Monday, July 19, 2010

Bash colours

Normal Colours
echo -e "\e[0;30m" Black
echo -e "\e[0;31m" Red
echo -e "\e[0;32m" Green
echo -e "\e[0;33m" Yellow
echo -e "\e[0;34m" Blue
echo -e "\e[0;35m" Purple
echo -e "\e[0;36m" Cyan
echo -e "\e[0;37m" White


Bold Colours

echo -e "\e[1;30m" Black
echo -e "\e[1;31m" Red
echo -e "\e[1;32m" Green
echo -e "\e[1;33m" Yellow
echo -e "\e[1;34m" Blue
echo -e "\e[1;35m" Purple
echo -e "\e[1;36m" Cyan
echo -e "\e[1;37m" White


Coloured with underline
echo -e "\e[4;30m"
echo -e "\e[4;31m"
echo -e "\e[4;32m" Green
echo -e "\e[4;33m"
echo -e "\e[4;34m" Blue
echo -e "\e[4;35m" Purple
echo -e "\e[4;36m" Cyan
echo -e "\e[4;37m" White

Background Colours
echo -e "\e[40m" Black
echo -e "\e[41m" Red
echo -e "\e[42m" Green
echo -e "\e[43m" Yellow
echo -e "\e[44m" Blue
echo -e "\e[45m" Purple
echo -e "\e[46m" Cyan
echo -e "\e[47m" White


Reset as of terminal colours
echo -e "\e[0m" Reset Text

The use of m indicates end of the codes

you can try out for combination
echo -e "\e[1;31m"Bold Red"\e[4;33m"Bold Yellow Underlined"\e[0;45m"Purple Background"\e[0m"