all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Gerry Agbobada <gerry@fiberplane.com>
Cc: 70941@debbugs.gnu.org
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	[thread overview]
Message-ID: <86pltouwly.fsf@gnu.org> (raw)
In-Reply-To: <4347621B-17D9-4CAD-933A-3E8F1DC46A84@fiberplane.com> (message from Gerry Agbobada on Tue, 14 May 2024 17:18:50 +0200)

> From: Gerry Agbobada <gerry@fiberplane.com>
> 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?





  reply	other threads:[~2024-05-14 17:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 15:18 bug#70941: 30.0.50; Low RGB color values use the terminal palette in TUI Gerry Agbobada
2024-05-14 17:33 ` Eli Zaretskii [this message]
2024-05-14 19:45   ` Gerry Agbobada
2024-05-18 10:23     ` Eli Zaretskii
     [not found]       ` <CAJ=DXSnmZxC20Xd_cB+3n_T3GeKmbSo=7xZG9DKYGKfOD965Pw@mail.gmail.com>
2024-05-18 15:41         ` Eli Zaretskii
2024-05-19 13:54           ` Gerry Agbobada
2024-05-19 15:34             ` Eli Zaretskii
2024-05-19 15:54               ` Gerry Agbobada
2024-05-19 16:27                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86pltouwly.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70941@debbugs.gnu.org \
    --cc=gerry@fiberplane.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.