Query or Change Dynamic Colors (OSC 10–19)

Query or change dynamic colors based on their indices.

  1. 0x1B
    ESC
  2. 0x5D
    ]
  3. ____
    n
  4. 0x3B
    ;
  5. ____
    c
  6. 0x1B
    ESC
  7. 0x5C
    \

When n is between 10 and 19 inclusive, either query or change the dynamic color corresponding to n depending on the value of c. c may be provided multiple times, each separated with a semicolon (;).

If c is given as a single character ?, then the terminal will respond with the color specification of the dynamic color at index n. If c is a valid color specification, then the dynamic color is changed according to it.

If there are more cs left in the sequence, then n is incremented by one, and the process repeats.

The correspondence between n and the dynamic colors are as follows:

nColor
10Foreground color
11Background color
12Cursor color
13Pointer foreground color
14Pointer background color
15Tektronix foreground color
16Tektronix background color
17Highlight background color
18Tektronix cursor color
19Highlight foreground color

Note

Currently, Ghostty only supports n between 10 and 12 inclusive. All other dynamic colors are ignored.

As an example, this sequence changes the background color and the cursor color to red and blue respectively:

  1. 0x1B
    ESC
  2. 0x5D
    ]
  3. 0x31 0x31
    11
  4. 0x3B
    ;
  5. 0x72 0x65 0x64
    red
  6. 0x3B
    ;
  7. 0x62 0x6C 0x75 0x65
    blue
  8. 0x1B
    ESC
  9. 0x5C
    \

This is equivalent to combining an OSC 11 and an OSC 12 together:

  1. 0x1B
    ESC
  2. 0x5D
    ]
  3. 0x31 0x31
    11
  4. 0x3B
    ;
  5. 0x72 0x65 0x64
    red
  6. 0x1B
    ESC
  7. 0x5C
    \
  1. 0x1B
    ESC
  2. 0x5D
    ]
  3. 0x31 0x32
    12
  4. 0x3B
    ;
  5. 0x62 0x6C 0x75 0x65
    blue
  6. 0x1B
    ESC
  7. 0x5C
    \