ANSI Escape Code Library
ANSI escape sequences are a standard for in-band signalling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators.
This library contains all ANSI Escape Codes that are defined in the ISO 6429 Standard. ISO 6429 is the international standard that followed from the efforts of aligning the european ECMA-48 Standard and the american ANSI X3.64 Standard.
Notation
In the ECMA-48 Standard a convention has been adopted to assist the reader of the Standard.
Capital letters are used to refer to a specific control function, mode, mode setting, or graphic character in order
to avoid confusion, for example, between the concept "space", and the character SPACE
.
As is intended by the ECMA-48 Standard, this convention and all acronyms of modes, and control functions are retained in this library, where rust permits.
A character from the ASCII table is represented in the form xx/yy
, where xx
represents the column
number 00
to 07
in a 7-bit code table, and yy
represents the row number 00
to 15
.
Low-Level Control Functions
The control functions of this library are sorted into several modules. You will find the low-level control functions in the modules [c0], [c1], [control_sequences], [independent_control_functions], and [control_strings].
The control functions can be put into normal strings. For example, to ring the bell:
use BEL;
println!;
Or to move the cursor to line 5, column 13:
use CUP;
print!;
It might be necessary in some circumstances to announce the active set of control sequences before they can be used. This is possible by invoking one of the announcer sequences.
use ;
// announce the C1 control function set, then move to the next line.
print!;
Source Material
The second, and newer, editions of the ECMA-48 Standard are based on the text of the ISO 6429 Standard and are technically identical with it. Since the ISO 6429 Standard is not freely available on the internet, this implementation is based on the publicly available documents of the ECMA-48 Standard. In particular on edition 5 of the ECMA-48 Standard, which is identical to the third edition of ISO-6429.
The ANSI X3.64 Standard has been withdrawn by ANSI in 1994 in favour of the international standard.
You can read more about the history of the standards on Wikipedia: ANSI escape code.