I found most of this somewhere and moved it to my site for adjustments. I don't know where exactly I found it though. My apologies for lack of credit.
ANSI escape codes are pretty prevalent in terminal emulation. Different codes are supported by different emulation "standards". Most of this is supported by VT102 but I think this listing is actually for ANSI.SYS. This is useful stuff for building mud-clients and dealing with curses-like applications without using curses.
If you find mistakes, email me: willg at bluesock dot org.
Good reading on issues that revolve around ANSI escape codes:
[ Back to the top ]
| ESC code sequence | Function | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cursor controls | |||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[#;#H or ESC[#;#f | moves cursor to line #, column # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[#A | moves cursor up # lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[#B | moves cursor down # lines | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[#C | moves cursor right # spaces | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[#D | moves cursor left # spaces | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[#;#R | reports current cursor line & column | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[s | save cursor position for recall later | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[u | Return to saved cursor position | ||||||||||||||||||||||||||||||||||||||||||||||||||
| erase functions | |||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[2J | clear screen and home cursor | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[K | clear to end of line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| color and text formatting | |||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[#(;#)m | there can be multiple text formatting sequence numbers
separated by a ; and ending with an m where the # is of the
following values:
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| screen modes | |||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[=#;7h or ESC[=h or ESC[=0h or ESC[?7h |
put screen in indicated mode where # is:
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| ESC[=#;7l or ESC[=l or ESC[=0l or ESC[?7l |
resets mode # set with above command | ||||||||||||||||||||||||||||||||||||||||||||||||||
[ Back to the top ]
Black \e[0;30m Blue \e[0;34m Green \e[0;32m Cyan \e[0;36m Red \e[0;31m Purple \e[0;35m Brown \e[0;33m Gray \e[0;37m Dark Gray \e[1;30m Light Blue \e[1;34m Light Green \e[1;32m Light Cyan \e[1;36m Light Red \e[1;31m Light Purple \e[1;35m Yellow \e[1;33m White \e[1;37m
[ Back to the top ]