Subscribe to Contour color palette update notifications
Well, we can't just poll the terminal for its theme every time we render (too much traffic) and there's no event that we receive for when the theme changes. In my opinion, TUI applications are not supposed to handle this edge case.
Understand, this is not necessary.
@lhecker well, Contour implements something:
Send
CSI ? 2031 hto the terminal to enable unsolicited DSR (device status report) messages for color palette updates andCSI ? 2031 lrespectively to disable it again.
FYI, that Contour extension is quite widely used by TUI libraries and applications, and I think there are one or two more terminals supporting it that aren't currently listed in the adoption table. Windows Terminal has an open issue for it here: https://github.com/microsoft/terminal/issues/18375