Use these escape sequences to change colors of texts on a color xterm. The table below shows values and their actions. Use the simple scripts below as examples of how to make use of these characteristics.
In sh, use this script:
esc=`echo -e '\e'`
color="${esc}[31;47m"
normal="${esc}[0m"
echo "${color}Color Test: here are the results${normal}"
In perl, use this script:
$esc = "\e";
$color = $esc . "[31;47m";
$normal = $esc . "[0m";
print $color . "Color Test: here are the results$normal\n";
Attribute
Description
0
Cancel all attributes except foreground/background color
1
Bright (bold)
2
Normal (not bold)
4
Underline
5
Blink
7
Reverse video
8
Concealed (don't display characters)
30
Make foreground (the characters) black
31
Make foreground red
32
Make foreground green
33
Make foreground yellow
34
Make foreground blue
35
Make foreground magenta
36
Make foreground cyan
37
Make foreground white
40
Make background (around the characters) black
41
Make background red
42
Make background green
43
Make background yellow
44
Make background blue
45
Make background magenta
46
Make background cyan
47
Make background white (you may need 0 instead, or in addition)