geostorm.org


UTC 17:11:04
Saturday
12/21/2024



December 2024
SuMoTuWeThFrSa 
1234567 
891011121314 
15161718192021 
22232425262728 
293031     
        
Calendar Tool

welcome

Color Escape Sequences

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";


AttributeDescription
0Cancel all attributes except foreground/background color
1Bright (bold)
2Normal (not bold)
4Underline
5Blink
7Reverse video
8Concealed (don't display characters)
30Make foreground (the characters) black
31Make foreground red
32Make foreground green
33Make foreground yellow
34Make foreground blue
35Make foreground magenta
36Make foreground cyan
37Make foreground white
40Make background (around the characters) black
41Make background red
42Make background green
43Make background yellow
44Make background blue
45Make background magenta
46Make background cyan
47Make background white (you may need 0 instead, or in addition)

1