mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
Use expected escape sequence for terminfo Tc and COLORTERM=truecolor
When the non-standard terminfo capability Tc is present, or the environment variable COLORTERM is set to truecolor, use a hard-coded escape sequence that addresses all colors directly by their RGB values. Previously we used escape sequences cribbed from terminfo's setaf/setab for direct color, that expect that we will only try to use colors 000000 to 000007 for the first eight indexed colors. This isn't something we currently handle. * doc/misc/efaq.texi (Colors on a TTY): Fix off-by-one error in list of indexed colors for terminfo RGB terminals. * src/term.c (init_tty): Don’t use any indexed colors with terminfo Tc capability or COLORTERM=truecolor environment variable (bug#70941).
This commit is contained in:
parent
4e165cc2d0
commit
84ae97f865
2 changed files with 12 additions and 6 deletions
|
|
@ -1973,7 +1973,7 @@ If Terminfo database is not available, but 24-bit direct color mode is
|
|||
supported, it can still be enabled by defining the environment
|
||||
variable @env{COLORTERM} to @samp{truecolor}.
|
||||
|
||||
Terminals with @samp{RGB} capability treat pixels #000001 - #000007 as
|
||||
Terminals with @samp{RGB} capability treat pixels #000000 - #000007 as
|
||||
indexed colors to maintain backward compatibility with applications
|
||||
that are unaware of direct color mode. Therefore the seven darkest
|
||||
blue shades may not be available. If this is a problem, you can
|
||||
|
|
|
|||
16
src/term.c
16
src/term.c
|
|
@ -4605,16 +4605,22 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
|
|||
signed values, tgetnum("Co") and tigetnum("colors")
|
||||
could return 32767. */
|
||||
tty->TN_max_colors = 16777216;
|
||||
|
||||
/* FIXME: When the RGB terminfo capability is given, we
|
||||
should avoid trying to use colors 000000 to 000007 as if
|
||||
they were RGB values. The escape sequences given by
|
||||
setaf and setab treat them as the first eight indexed
|
||||
ANSI colors. */
|
||||
}
|
||||
/* Fall back to xterm+direct (semicolon version) if Tc is set
|
||||
(de-facto standard introduced by tmux) or if requested by
|
||||
the COLORTERM environment variable. */
|
||||
/* Fall back to direct colour by RGB value (semicolon version)
|
||||
if Tc is set (de-facto standard introduced by tmux) or if
|
||||
requested by the COLORTERM environment variable. */
|
||||
else if ((tigetflag ("Tc") > 0)
|
||||
|| ((bg = getenv ("COLORTERM")) != NULL
|
||||
&& strcasecmp (bg, "truecolor") == 0))
|
||||
{
|
||||
tty->TS_set_foreground = "\033[%?%p1%{8}%<%t3%p1%d%e38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";
|
||||
tty->TS_set_background = "\033[%?%p1%{8}%<%t4%p1%d%e48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";
|
||||
tty->TS_set_foreground = "\033[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";
|
||||
tty->TS_set_background = "\033[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m";
|
||||
tty->TN_max_colors = 16777216;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue