Subject: bug#62237: 28.1 or higher: 24-bit true color breaks colours in Emacsen built without X under GNU Screen

From: Sebastian Tennant <[email-masked]>
Date: Fri, 17 Mar 2023 18:31:18 +0000

Quoth Eli Zaretskii <[email-masked]>
on Fri, 17 Mar 2023 18:42:43 +0200:
>> From: Sebastian Tennant <[email-masked]>
>> Cc: [email-masked]
>> Date: Fri, 17 Mar 2023 16:20:19 +0000
>>
>> […]
>> The photos happen to show an Emacs I built from master a couple of
>> days ago, i.e. Emacs 30.0.50.  If you'd still like me to test branch
>> emacs-29, then let me know and I will happily do so.
>
> No, Emacs 30 is good enough.  (Your report says Emacs 28.1, which is
> why I asked.)

It's easy to miss the "or higher".

>> […]
>> This lead me to investigate whether or not COLORTERM was set in my
>> environment.  I'm running Debian bullseye and terminfo is installed
>> but, nevertheless, GNOME Terminal sets COLORTERM=truecolor by default.
>
> What is TERM set to on that system?

In a plain GNOME Terminal, i.e. outside screen:

 xterm-256color

>> […]
>>
>>  https://download.sebyte.me/misc/truecolor-active.png
>>  https://download.sebyte.me/misc/truecolor-inactive.png
>
> This seems to say that your terminal isn't compatible with what
> Emacs assumes under COLORTERM=truecolor.

It would seem so.

> It also says that your terminal actually supports only 88 colors.

How do you infer that?

> So you should unset COLORTERM in your environment

That's precisely the fix I discovered yesterday.

> or use another terminal emulator (like 256-color Xterm or some
> really true-color emulator).

According to:

 https://github.com/termstandard/colors

command:

 $ printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"

shows your terminal is capable of truecolor if the word TRUECOLOR is
printed in brown.  According to the result of this test, GNOME
Terminal (3.38.3) _is_ truecolor enabled.

I can observe the same broken colours in xterm (under the same
conditions) shipped by Debian bullseye.

I'm sure it has to do with screen and will investigate whther or not
my version of screen supports truecolor.

Seb