Posted on 2005-11-15 11:37
幽灵狼 阅读(602)
评论(0) 编辑 收藏 引用 所属分类:
Development
ANSI Escape Sequence
Clear Display
| Function |
ESC Sequence |
Description |
| Clear Screen |
ESC[2J |
Clear the whole screen and position the cursor to the top left corner. |
| Clear Line |
ESC[K |
Clear line, from cursor position to the right most position of line. |
Cursor Movement
| Function |
ESC Sequence |
Description |
| Move Up |
ESC[numA |
Move the cursor up num positions |
| Move Down |
ESC[numB |
Move the cursor down num positions |
| Move Right |
ESC[numC |
Move the cursor right num positions |
| Move Left |
ESC[numD |
Move the cursor left num positions |
| Move to Position |
ESC[row;colH |
Move the cursor to the (col, row) position. Note that the row comes before column; that is, y comes before x. Either col or row can be omitted. Row and column both start with "1," not zero. (1, 1) corresponds to the top-left corner of the screen. |
| Move to Position |
ESC[row;colf |
Same as above. |
Save and Restore Cursor Position
| Function |
ESC Sequence |
Description |
| Save Cursor Positon |
ESC[s |
Save the cursor position for later restoration. |
| Restore Cursor Positon |
ESC[u |
Restore the cursor position previously saved. |
Character Mode
| Function |
ESC Sequence |
Description |
| Change Character Mode |
ESC[attrm |
Change the character mode with attribute attr. The attributes are numbers listed below. |
| Change Character Mode |
ESC[attr;...;attrm |
Change the character mode with attributes attr;...;attr. The attributes are numbers listed below. |
| All Off |
0 |
All attributes turned off. (Except for foreground and background color). |
| High Intensity |
1 |
Bold. |
| Low Intensity |
2 |
Normal. |
| Italic |
3 |
Work only on some systems. |
| Underline |
4 |
Underline font. |
| Blink |
5 |
Blinking font. |
| Rapid Blink |
6 |
Works only on some systems. |
| Reverse Video |
7 |
Swapping the foreground color and the background color. |
| Invisible |
8 |
Do not display characters. |
| Foreground Color |
30 |
Black. |
| Foreground Color |
31 |
Red. |
| Foreground Color |
32 |
Green. |
| Foreground Color |
33 |
Yellow. |
| Foreground Color |
34 |
Blue. |
| Foreground Color |
35 |
Magenta. |
| Foreground Color |
36 |
Cyan. |
| Foreground Color |
37 |
White. |
| Background Color |
40 |
Black. |
| Background Color |
41 |
Red. |
| Background Color |
42 |
Green. |
| Background Color |
43 |
Yellow. |
| Background Color |
44 |
Blue. |
| Background Color |
45 |
Magenta. |
| Background Color |
46 |
Cyan. |
| Background Color |
47 |
White. |
thanks to Kenneth Kin Lum.