Supported VT100 escape sequences

VT100 escape sequences, also called escapes (in this documentation) are a sequence of ANSI character codes. Escapes always begin with the sequence introducer, the CSI, which is composed of the character ESC followed by a '[' (ANSII character code 27, or 1B in hexadecimal, followed by a left square open parenthesis).

See ANSI escape sequences set on wikipedia for more in-depth information.

Render Mode

Persistence of graphic properties

When Consoul outputs text lines on its window, the recognized escapes are not displayed but interpreted; the corresponding graphic properties are applied on the fly for the output text that follows them. Properties that are changed by these control sequences persist on the next line, unless a RESET sequence is encountered, which reverts back all the graphic rendition properties to their defaults. This is further referenced as continuous render mode.

Non persistence of graphic properties

Consoul's console windows persistence of graphic properties can be turned off at window creation time (CSCreateLogWindow() with LW_RENDERMODEBYLINE flag). In this display mode, all graphic properties are automatically reset at the next display line. This is further referenced as by line render mode.

Supported VT100 compatible SGR subset

Consoul supports the following subset of the SGR (Select Graphic Rendition) ANSI escapes: (anything between single quotes represents an ANSI string, or a single character)

Name Sequence Description
RESET CSI+'0'+'m' Resets the foreground and background color to the console window defaults, and clears font attributes.
The condensed sequence that drops the '0' in this sequence and that is accepted by the VT100 specification is not supported by Consoul.
INVERSE_ON CSI+'7'+'m' Activates the inverse (also called reverse) video mode, which switches the background and foreground colors.
INVERSE_OFF CSI+'27'+'m' Switches back fore/back colors.
BOLD_ON CSI+'1'+'m'
BOLD OFF CSI+'21'+'m'
SET FOREGROUND COLOR CSI+'38;'+'32_bits_color_value'+'m' or CSI+'38;'+'r;g;b'+'m' Sets the color of the text (foreground) to either specifying a 32 bits color value, or by specifying a rgb triplet, where each value is separated by a semicolon. The 32 bits color value can be specified in decimal (base 10) or hexadecimal by prepending a dollar sign, like: "$FF6699".
SET BACKGROUND COLOR CSI+'48;'+'32_bits_color_value'+'m' or CSI+'48;'+'r;g;b'+'m' Same rules as SET FOREGROUND COLOR, for the background color (the color of the square behind each following characters)

Special Consoul escapes (Extensions)

Consoul supports additional custom escape sequences, that are used to define the starting end ending positions of a zone.


Zone escape sequences are used to define an area on a console line. More on zones...

Name Sequence Description
ZONE_BEGIN CSI+'98;'+'zoneid[zone tag]'+'m' Begin a zone, zoneid must a 16 bits integer value. An arbitrary string (which should not containe the "m" char), a tag, can be attached to the zone definition. The CSGetZoneTag function can be used to read a zone tag.
ZONE_END CSI+'99'+'zoneid'+'m' End a zone. Must be on the same output line that the zone begin escape. A non closed zone is automatically closed at the end of a line


Other Consoul vt100 extensions

Name Sequence Description
VT100X_SETWIDTH CSI+'100;'+'pixel_width'+'m' Set the width of the space taken by the next text block output to pixel_width pixels. If the text block is larger, it will be cut, if smaller, the next drawing rectangle x position will advance until the text block width reaches pixel_width
VT100X_ADVANCEABS CSI+'101;'+'pixels'+'m' Moves the next x position of the drawing rectangle at exactly pixels, from the left border
VT100X_ADVANCEREL CSI+'102;'+'pixels'+'m' Advance the next x position of the drawing rectangle by pixels, from the current position
VT100X_SAVEGPOS CSI+'103;'+'m' Saves the current graphical output x position. This position can be later returned to with a VT100X_RESTOREGPOS escape sequence. Can be used to overwrite any output done between the two sequences.
VT100X_DTFLAGS CSI+'110;'+'DrawTextFlags'+'m' Consoul uses the DrawText() Windows API to output text. The default flags passed to the DrawText API are DT_SINGLELINE | DT_NOPREFIX | DT_LEFT. These flags are reset to the default value before starting to output each line. This escape sequence is used to specify any other combination of flags that will be passed to the next block outputs for the line. A VT_RESET sequence does not reset the flags to the default value.
VT100X_BKCOLSPILL CSI+'111;'+'0 or 1'+'m' Turns off(0) or on(1) the "BackColor Spill" feature for the rest of the line. A VT_RESET sequence does not reset the BackColor Spill feature to off(0); to do that, just issue another VT100X_BKCOLSPILL sequence (with 0 (zero)).
Last updated: May 13 2022.