[Tickit-dev] Identifying terminals that support 24bit colours (RGB8)

Ross Mohn rpmohn at waxandwane.org
Wed Dec 8 00:27:14 GMT 2021


Hi, would you consider this small patch to the start() function in 
termdriver-xterm.c? I've tested it on several terminal emulators with 
the demo-rgb8 example and it seems to fix things. Here's a diff:

     diff --git a/src/termdriver-xterm.c b/src/termdriver-xterm.c
     index 1368f4d..d7823b9 100644
     --- a/src/termdriver-xterm.c
     +++ b/src/termdriver-xterm.c
     @@ -474,6 +474,11 @@ static void start(TickitTermDriver *ttd)
        // whether it understands : to separate sub-params
        tickit_termdrv_write_strf(ttd, 
"\e[38;5;255m\e[38:2:0:1:2m\eP$qm\e\\\e[m");

     +  struct XTermDriver *xd = (struct XTermDriver *)ttd;
     +  const char *colorterm = getenv("COLORTERM");
     +  if (colorterm && (strstr(colorterm, "truecolor") || 
strstr(colorterm, "24bit")))
     +    xd->cap.rgb8 = 1;
     +
        /* Some terminals (e.g. xfce4-terminal) don't understand DECRQM 
and print
         * the raw bytes directly as output, while still claiming to be 
TERM=xterm
         * It doens't hurt at this point to clear the current line just 
in case.

Thank you. -Ross

-- 
Ross Mohn <rpmohn at waxandwane.org>
OpenPGP: 0xFBB698141F0A6737
http://waxandwane.org/



More information about the Tickit-dev mailing list