From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70941: 30.0.50; Low RGB color values use the terminal palette in TUI Date: Tue, 14 May 2024 20:33:29 +0300 Message-ID: <86pltouwly.fsf@gnu.org> References: <4347621B-17D9-4CAD-933A-3E8F1DC46A84@fiberplane.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38862"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70941@debbugs.gnu.org To: Gerry Agbobada Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 14 19:34:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s6w2W-0009sV-WD for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 May 2024 19:34:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6w2L-0001fp-PE; Tue, 14 May 2024 13:34:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6w2L-0001fd-0x for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 13:34:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6w2K-00031C-Nt for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 13:34:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s6w2L-0002Z5-MI for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 13:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 May 2024 17:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70941 X-GNU-PR-Package: emacs Original-Received: via spool by 70941-submit@debbugs.gnu.org id=B70941.17157080239838 (code B ref 70941); Tue, 14 May 2024 17:34:01 +0000 Original-Received: (at 70941) by debbugs.gnu.org; 14 May 2024 17:33:43 +0000 Original-Received: from localhost ([127.0.0.1]:40512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6w23-0002Yc-4O for submit@debbugs.gnu.org; Tue, 14 May 2024 13:33:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6w20-0002YT-KY for 70941@debbugs.gnu.org; Tue, 14 May 2024 13:33:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6w1t-0002zf-MK; Tue, 14 May 2024 13:33:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=NNkxYjYQAKwEacksUtkTjVGQ0o+6nDj/p0/seZviTQw=; b=l0xJckKj/cdL eNttUeWXesNLUAP+NaVpZkFTOPolwNSgLQ1neZuAUnmzkq6aXCotPrWGCy0QFAdmWnRhBQFhSv1bF CzLyvXM4KTKO7H/oFQWRk8jrS6EpMvKa5C5kvzYxnWNUqWKfxf/Gf2H7yhGD0p8//1K1qX7mdQNOO rBNtNXH/hH+DOAX/S/xIlrFUa1etKVWZfBX1/7U6c+YCMxPxwugXVMWhsL5ABapfJkv78QRnciqq9 wRVzUFs0fSnvmEMeZMjazriEej6lB3PPXsKveSggUWFo5p4IaVQfhBfRQlQaSUNkjLgZpXqSjW+Li SwUacVB+/TAXsLiquxhARg==; In-Reply-To: <4347621B-17D9-4CAD-933A-3E8F1DC46A84@fiberplane.com> (message from Gerry Agbobada on Tue, 14 May 2024 17:18:50 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285034 Archived-At: > From: Gerry Agbobada > Date: Tue, 14 May 2024 17:18:50 +0200 > > When using Emacs in a terminal that can handle 24-bit color codes, Emacs > still shows the "terminal palette" colors when using the low bits. > > The full terminfo file for wezterm can be found in the repo: > https://github.com/wez/wezterm/blob/f1a0842608932a9f17b20ae4123d3a296dda525a/termwiz/data/wezterm.terminfo Emacs doesn't have a lisp/term/wezterm.el file, so the question is what is your TERM environment variable set to? > The relevant (I think?) lines are > > #+begin_src > setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, > setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, > #+end_src I think the relevant terminfo capabilities for 24-bit colors are setf24 and setb24, not setab and setaf. > * Repro: > > ** Setup > Evaluate the following code in a terminal with a light theme in Emacs (I > tested it with a beta terminal called ghostty, and in wezterm) > > #+begin_src emacs-lisp > (let* > ((colors > '("#000000" "#000001" "#000002" "#000003" "#000004" "#000005" "#000006" "#000007" > "#000008" "#000009" "#00000A" "#00000B" "#00000C" "#00000D" "#00000E" "#00000F" "#000010" > "#00aa00")) > (test-strings (mapconcat (lambda (color) (propertize color 'face `(:foreground ,color))) colors "\n"))) > (save-excursion > (goto-char (point-max)) > (insert "\n") > (insert test-strings))) > #+end_src > > ** Expected > The first 16 colors are very dark, and the last one is green You expect the terminal to obey the X RGB color specification directly, but that is not how TTY color support works in Emacs. Emacs approximates each X color using the colors that the terminal actually supports. So we should start by looking at the color setup and how many colors that yields. What does "M-x list-colors-display" produce?