Colors
TermSurf emulates a full 256-color palette, as well as 5 special colors and 3 dynamic colors.
Special Colors
The special colors, when specified, are used to color cells with particular styles — bold, underline, blink, reversed and italic. They can be queried or changed either with OSC 4 using indices from 256 to 260 inclusive, or OSC 5 with indices from 0 to 4 inclusive respectively. The ordinary palette colors are used instead of special colors when not specified.
Dynamic Colors
The dynamic colors are used by the terminal to color cells independent of their own styles, when they are selected, highlighted, etc. They are also supposed to be dynamically updated by programs after the terminal has been initialized, hence their name. TermSurf supports three of these colors: the foreground color, the background color and the cursor color, which are queried or modified with OSCs 10 to 12 respectively.
Color Specifications
Each color in the terminal is specified with a color specification.
These originated from xterm, which allows any string that can be parsed by
X11’s standard XParseColor function to serve as a color. However, since
TermSurf supports platforms other than X11, it has its own color parser that
is compatible but not guaranteed to be the same as xterm, which is
documented below.
Hexadecimal RGB
-
- 0x72 0x67 0x62 0x3A
- rgb:
-
- ____
- r
-
- 0x2F
- /
-
- ____
- g
-
- 0x2F
- /
-
- ____
- b
-
- 0x23
- #
-
- ____
- r
-
- ____
- g
-
- ____
- b
Where each of r, g and b can be one to four hexadecimal digits,
corresponding to 4, 8, 12 or 16 bit color channels respectively.
NOTE
When using the # syntax, each channel must have the same number of
digits.
Intensity RGB
Another format uses the numerical intensity of each channel, as follows:
-
- 0x72 0x67 0x62 0x69 0x3A
- rgbi:
-
- ____
- r
-
- 0x2F
- /
-
- ____
- g
-
- 0x2F
- /
-
- ____
- b
Where each of r, g and b is a decimal number between 0 and 1.
Named
Certain colors can also be specified with their names. The exact list of
accepted color names are implementation-defined, but TermSurf uses the
X color name database as used
by X11 itself. The colors are ASCII case-insensitive, meaning red and RED
correspond to the same color.