ANSIEscapeCodes
ANSIEscapeCodes are a family of in-band control sequences used to control formatting, color, and cursor movement in text terminals and terminal emulators. They originated in the ANSI X3.64 standard (also known as ECMA-48 and ISO/IEC 6429) and are transmitted as sequences starting with the escape character. The most common subset is the CSI, or Control Sequence Introducer, which uses ESC followed by [ and then parameters and a final byte that selects the command. The Select Graphic Rendition (SGR) subset is widely used to set text attributes such as color and style.
SGR sequences enable a range of effects. For example, ESC [ 0 m resets attributes, ESC [ 1
In addition to styling, CSI sequences control cursor position and screen manipulation. Examples include ESC [ 2
Usage and portability vary by terminal. Most Unix-like terminals and modern terminal emulators support ANSI escape