This is for reference, on systems that limit access to github gist.
ANSI Escape Sequences
Standard escape codes are prefixed with Escape:
- Ctrl-Key:
^[ - Octal:
\033 - Unicode:
\u001b - Hexadecimal:
\x1B - Decimal:
27
Followed by the command, sometimes delimited by opening square bracket ([), known as a Control Sequence Introducer (CSI), optionally followed by arguments and the command itself.
Arguments are delimited by semi colon (;).
For example:
\x1b[1;31m # Set style to bold, red foreground.
Sequences
ESC- sequence starting withESC(\x1B)CSI- Control Sequence Introducer: sequence starting withESC [or CSI (\x9B)DCS- Device Control String: sequence starting withESC Por DCS (\x90)OSC- Operating System Command: sequence starting withESC ]or OSC (\x9D)
Any whitespaces between sequences and arguments should be ignored. They are present for improved readability.