User Tools

Site Tools


coding:ansi

Escape Codes

Not strictly ANSI, but that's the name that always comes to mind when I want to look this stuff up.

Colour

Taken from http://en.wikipedia.org/wiki/ANSI_escape_code#Codes

\033[n;km

Where n is a colour number, and k is a format code.

Color table#cite_ref-3[4]
Intensity 0 1 2 3 4 5 6 7 9
Normal Black Red Green Yellow#cite_ref-4[5] Blue Magenta Cyan White reset
Bright Black Red Green Yellow Blue Magenta Cyan White
#graphicsSGR (Select Graphic Rendition) parameters
Code Effect Note
0 Reset / Normal all attributes off
1 Intensity: Bold
2 Intensity: Faint not widely supported
3 Italic: on not widely supported. Sometimes treated as inverse.
4 Underline: Single
5 Blink: Slow less than 150 per minute
6 Blink: Rapid MS-DOS ANSI.SYS; 150 per minute or more
7 Image: Negative inverse or reverse; swap foreground and background
8 Conceal not widely supported
21 Underline: Double not widely supported
22 Intensity: Normal not bold and not faint
24 Underline: None
25 Blink: off
27 Image: Positive
28 Reveal conceal off
30–39 Set foreground color, normal intensity 3x, where x is from the color table above
40–49 Set background color, normal intensity 4x, where x is from the color table above
90–99 Set foreground color, high intensity aixterm
100–109 set background color, high intensity aixterm

(From http://rtfm.etla.org/xterm/ctlseq.html#CSI%20Pm%20m)

``
If 88- or 256-color support is compiled, the following apply.
3 8 ; 5 ; Ps 	Set background color to Ps
4 8 ; 5 ; Ps 	Set foreground color to Ps

Movement

Terminal Control

See http://rtfm.etla.org/xterm/ctlseq.html

  • \033[3;x;yt Move window to position x, y
  • \033]0;title here\007 Set window title to title here
  • \033[9;1t Maximise window
coding/ansi.txt · Last modified: 2009/12/10 16:58 by robm