Ansi code guide <html> version HOME

This file is the html version of ansi.ans. Ansi codes begin with ^[ aka ESC or '\033'. Often they start with ^[[ or ^[O. The following codes are used on input. Some are also used on output.

KeyboardCodeOutput Action if any or comment
Ctrl-?It's the character given by taking the capital letter's ASCII code and subtracting 64. See ascii.asc.
Alt-?Usually represented by ^[X where X is the capital letter.
Up^[[AGo up a line
Down^[[BGo down a line
Right^[[CGo right a line
Left^[[DGo left a line
End^[OF
Home^[OH
Insert^[[2~
Delete^[[3~
PageUp^[[5~
PageDown^[[6~
F1^[OP
F2^[OQ
F3^[OR
F4^[OS
F5^[[15~
F6^[[17~not a typo... q(>n<)
F7^[[18~
F8^[[19~
F9^[[20~
F10^[[21~
F11^[[23~again, not a typo... (;-;)
F12^[[24~

Simple Output Sequences:

Where there is an optional number operand, I put a red N. The default is usually 1.

^[[NAUp N rows.
^[[NBDown N rows.
^[[NCRight N columns.
^[[NDLeft N columns.
^[[NEBeginning of the line N lines down.
^[[NFBeginning of the line N lines up.
^[[NGMove to column N.
^[[N;MHMove to row N column M.
^[[0JErase everything below cursor.
^[[1JErase everything above cursor.
^[[2JErase everything.
^[[0KErase in the line to right of cursor.
^[[1KErase in the line to left of cursor.
^[[2KErase the whole line.

Graphical Output Sequences.

All the graphical sequences are contained in a sequence like ^[[Xm where X is a sequence of integers separated by semicolons.

Each integer has a different meaning:

0Reset all graphics to normal.
1Bold, often brightens the color as well/instead.
2Dim, usually actually does underline.
3Italic, usually actually does reverse video.
4Underline.
5Blink, usually actually does bold.
7Reverse video.
8Invisible. (rarely works)
9Crossed-out. (rarely works)
21Double underline. (rarely works)
22Un-bold text.
23Un-italic text.
24Un-underlined text.
25Un-blinking text.
27Un-reverse video.
28Un-invisible text.
29Un-crossed-out text.
30Text color black. Text color black, that is.
31Text color red.
32Text color green.
33Text color yellow.
34Text color blue.
35Text color magenta.
36Text color cyan.
37Text color white.
39Text color default.
40Bg color black., bg color black, that is.
41Bg color red.
42Bg color green.
43Bg color yellow.
44Bg color blue.
45Bg color magenta.
46Bg color cyan.
47Bg color white., bg color white that is.
49Bg color default.