Comment by tfsh
2 days ago
This looks really cool, I'd like to give it a go. The idea of taking a screenshot of the terminal and then parsing that to determine the true colour support is definitely novel, though perhaps so, because for me I can't get it to work. Are there any debug flags I can enable?
So far it was able to take the screenshot correctly (https://ibin.co/8kaRr8TIanv2.png), however the parsing of that fails with the non-descript "Palette parsing failed." error.
Edit: enabled tracing at got this: https://paste.ee/p/ZyNxG9FK
> 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.
Thanks for trying it out. It looks like either your terminal or screenshotter isn't faithfully rendering the pure red marker column (it's needed for calibration in the parser). The red should be #ff0000, but the screenshot is using #ea3323. I've made a Github issue to keep track https://github.com/tattoy-org/tattoy/issues/98 If you can add more details it'd really useful, I'm sure there'll be more people like you.
Maybe that's night mode (or whatever your DE calls it)?
Interesting, I'd never thought of that.