Closed kilobyte closed 7 years ago
Hey thanks for letting me know. It seems not to exist a way to detect it yet, though. So what do you recommend?
Closing due to inactivity
Sadly, I found no way to reliably detect 24-bit support. Only two libraries provide such a way: newer versions of libvte set an env var VTE_VERSION, Konsole produces four: KONSOLE_DBUS_SERVICE, KONSOLE_DBUS_SESSION, KONSOLE_DBUS_WINDOW, KONSOLE_PROFILE_NAME.
Because of a terrible misdesign, printing 24-bit codes results in garbage if not supported: ANSI codes are supposed to be safely ignorable when not supported, but T416 where 256/24-bit/CMY/CMYK comes from disregarded these principles.
Thus, I'm afraid defaulting to 24-bit is a bad idea, at least until terminals themselves are fixed. And a number of them declared 24-bit support as WONTFIX.
For some reason, you assume 24-bit color codes are available when in Unicode mode, and 256 color otherwise. These capabilities are completely unrelated.
Not all terminals support 24-bit colors (https://gist.github.com/XVilka/8346728 -- non-fringe ones are Putty, Terminology and aterm; silently downconverting as xterm does is acceptable).
Non-Unicode is nearly extinct.
Too bad, neither of those imply the other.