bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#70941: 30.0.50; Low RGB color values use the terminal palette in TUI


From: Eli Zaretskii
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

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]