4.4.3 Colour on text terminal
Colour on the text terminal can be produced using the "ANSI escape sequences". For example:
echo -e "\033[44;37;5m ME \033[0m COOL"
The above sets the background to blue, foreground white, blinking video, and prints " ME ", then resets the terminal back to defaults and prints " COOL". The "-e" is an option specific to the echo command--it enables the interpretations of the special characters. The "\033[" introduces the escape sequence. The "m" means "set attribute" and thus finishes the sequence. The actual codes in the example above are "44;37;5" and "0".
Change the "44;37;5" to produce different colour combinations--the number/order of codes do not matter. The codes to choose from are listed below:
Code Action/Color
---------------------------
0 reset all attributes to their defaults
1 set bold
2 set half-bright (simulated with color on a color display)
4 set underscore (simulated with color on a color display)
5 set blink
7 set reverse video
22 set normal intensity
24 underline off
25 blink off
27 reverse video off
30 set black foreground
31 set red foreground
32 set green foreground
33 set brown foreground
34 set blue foreground
35 set magenta foreground
36 set cyan foreground
37 set white foreground
38 set underscore on, set default foreground color
39 set underscore off, set default foreground color
40 set black background
41 set red background
42 set green background
43 set brown background
44 set blue background
45 set magenta background
46 set cyan background
47 set white background
49 set default background color
Other interesting codes:
\033[2J clear screen
\033[0q clear all keyboard LEDs (won't work from Xterm)
\033[1q set "Scroll Lock" LED
\033[2q set "Num Lock" LED
\033[3q set Caps Lock LED
\033[15;40H move the cursor to line 15, column 40
\007 bell (beep)
LEDs (="Light Emitting Diods) are the lights on the keyboard which indicate if <CapsLock>, <NumLock> and <ScrollLock> are engaged.
See man console_codes for more.
* License

