GNU bug report logs - #48755
28.0.50; Emacs doesn't detect the terminal background color in macOS Terminal or iTerm2

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Sun, 30 May 2021 22:21:02 UTC

Severity: normal

Found in version 28.0.50

To reply to this bug, email your comments to 48755 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#48755; Package emacs. (Sun, 30 May 2021 22:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Martín <mardani29 <at> yahoo.es>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 30 May 2021 22:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Martín <mardani29 <at> yahoo.es>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Emacs doesn't detect the terminal background color in
 macOS Terminal or iTerm2
Date: Mon, 31 May 2021 00:20:35 +0200
Steps to reproduce the problem:

- Start macOS Terminal or iTerm2 (both are probably the most popular
terminals for macOS).

- Switch the terminal background color to a dark color.

- emacs -nw -Q

Actual result:

Colored text is sometimes very difficult to read, because Emacs assumes
it's running on a light terminal background, and configures the faces
accordingly.

Expected result:

Emacs faces are those of a dark background.

Workaround:

Customize frame-background-mode to 'dark.

Here's some information about macOS Terminal and iTerm2.  Apparently,
they both identify as xterm-256color and support querying the background
color:

macOS Terminal:

$ printf '\e[>0c'
1;95;0c

$ printf '\e]11;?\e\'
11;rgb:0000/0000/0000

$ echo $TERM
xterm-256color

iTerm2:

$ printf '\e[>0c'
0;95;0c

$ printf '\e]11;?\e\'
11;rgb:0000/0000/0000

$ echo $TERM
xterm-256color

I tried to fix the problem by taking a look at xterm--version-handler in
xterm.el, but the version logic is a bit difficult to understand.  Is
there some documentation about the versions and capabilities somewhere?
I'm worried about changing things there may cause regressions in other
terminals.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48755; Package emacs. (Mon, 31 May 2021 12:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 48755 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Martín <mardani29 <at> yahoo.es>
Cc: 48755 <at> debbugs.gnu.org
Subject: Re: bug#48755: 28.0.50;
 Emacs doesn't detect the terminal background color in macOS Terminal
 or iTerm2
Date: Mon, 31 May 2021 15:02:52 +0300
> Date: Mon, 31 May 2021 00:20:35 +0200
> From:  Daniel Martín via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> I tried to fix the problem by taking a look at xterm--version-handler in
> xterm.el, but the version logic is a bit difficult to understand.  Is
> there some documentation about the versions and capabilities somewhere?

The canonical source for xterm documentation is here:

  https://invisible-island.net/xterm/manpage/xterm.html




This bug report was last modified 2 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.