mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-11 11:49:40 +00:00
Add a shared encoder for CSI ? 997 ; Ps n color scheme reports and use it for both CSI ? 996 n replies and unsolicited Termio reports. Export the same encoder through the libghostty-vt C API with docs and an example. This is a really light API, arguably easy for consumers to hardcode, but it didn't match the rest of our style in the libghostty API so we should expose it. Example: GHOSTTY_COLOR_SCHEME_DARK encodes to ESC [ ? 997 ; 1 n, while GHOSTTY_COLOR_SCHEME_LIGHT encodes to ESC [ ? 997 ; 2 n.
Example: ghostty-vt Color Scheme Report Encoding
This contains a simple example of how to use the ghostty-vt color scheme
report encoding API to encode terminal color scheme reports into escape
sequences.
This uses a build.zig and Zig to build the C program so that we
can reuse a lot of our build logic and depend directly on our source
tree, but Ghostty emits a standard C library that can be used with any
C tooling.
Usage
Run the program:
zig build run