Comment by shiomiru

3 days ago

> The idea of taking a screenshot of the terminal and then parsing that to determine the true colour support is definitely novel,

A better way to do this is to send `OSC 1 0 ; ? ST` (query foreground color), `OSC 1 1 ; ? ST` (background color), then `OSC 4 ; {n} ; ? ST` where {n} is the nth XTerm color.

See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-O...

OMG really!? That link is blocked for me for some reason. If that OSC code is widely supported it's going to make things sooooo much easier.

  • It’s very widely supported from my experience. This is how asciinema captures terminal palette.

  • It’s supported by any xterm compatible terminal emulator. But like with most things in this domain, expect plenty of edge cases where it should work but doesn’t.