Etermal
Embeddable Terminal and shell for OpenGL
Terminal escape sequences

Intro

ANSI terminal escape sequences are pretty cool. They allow you to color text and do all sorts of cool stuff.

Well, Terminal has support for a version of ansi escapes that is based off of ANSI that gives a little more customization.

Description

Syntax

The syntax emulates ANSI: <ESC>[<command><arg>;

Where <ESC> is the escape char 0x1b, <command> is a single digit command, and <arg> is the argument(s).

Not all commands have arguments.

Commands

Commands are single letters and always come right after the bracket [.

Command Parameters Description
b 24-bit (RGB) Hex color value Sets the background color for all following text
f 24-bit (RGB) Hex color value Sets the foreground color for all following text
B None Reverts the background color to the default
F None Reverts the foreground color to the default
r None Sets all styles to their default
Note
Parameters can optionally be terminated early by appending a semicolon ;. This can be necessary if you want to, say, use RGB values like 0x0000ff but don't want to have the trailing zeros, so you instead do <ESC>[bff;. the ff will be interpreted as 0x0000ff (blue). You can even go further, and do [f;, omitting parameters entirely, causing the background to be set to black.

Hex values

Hexidecimal values can be taken as parameters for some commands. The way they're represented is extreamly straightforward:

0x432ff3 -> 432ff3
0x123456 -> 123456

As you can see, you just strip the decoration (in this case the 0x, other times may be #).

Examples

<ESC>[ff0b105 - sets foreground color to a nice orange
<ESC>[fff2f00 - sets background color to a harsh red
<ESC>[fff; - sets background color to blue. same as <ESC>[f0000ff