Colors

All sorts of information regarding colors in terminal emulation.

Ghostty 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. Ghostty currently 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 Ghostty supports platforms other than X11, we have our own color parser that is compatible but not guaranteed to be the same as xterm, which is documented below.

Hexadecimal RGB

  1. 0x72 0x67 0x62 0x3A
    rgb:
  2. ____
    r
  3. 0x2F
    /
  4. ____
    g
  5. 0x2F
    /
  6. ____
    b

  1. 0x23
    #
  2. ____
    r
  3. ____
    g
  4. ____
    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.

Additionally, Ghostty does not yet recognize 16-bit color channels when using the # syntax. This is a limitation that may be resolved in the future.

Intensity RGB

Another format uses the numerical intensity of each channel, as follows:

  1. 0x72 0x67 0x62 0x69 0x3A
    rgbi:
  2. ____
    r
  3. 0x2F
    /
  4. ____
    g
  5. 0x2F
    /
  6. ____
    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 Ghostty 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.