Document setrgbb, setrgbf, and Tc terminal capabilities

* doc/misc/efaq.texi (Colors on a TTY): Mention the unofficial
setrgbb, setrgbf, and Tc terminal capabilities, and give an
example custom terminfo defintion using them.  (Bug#70941)
This commit is contained in:
Peter Oliver 2026-04-22 12:32:06 +01:00 committed by Eli Zaretskii
parent 74d411d600
commit fe1d9562f1

View file

@ -1914,14 +1914,40 @@ exhibits all the colors Emacs knows about on the current display.
Syntax highlighting is also on by default on text-only terminals.
@cindex direct color in terminals
Emacs 26.1 and later support direct color mode in terminals. If Emacs
finds Terminfo capabilities @samp{setb24} and @samp{setf24}, 24-bit
direct color mode is used. The capability strings are expected to
take one 24-bit pixel value as argument and transform the pixel to a
string that can be used to send 24-bit colors to the terminal.
Emacs 26.1 and later support direct color mode in terminals.
Standard terminal definitions don't support these capabilities and
therefore custom definition is needed.
If Emacs finds Terminfo capabilities @samp{setrgbb} and @samp{setrgbf},
@samp{setb24} and @samp{setf24}, or @samp{Tc}, 24-bit direct color mode
is used. Standard terminal definitions don't support any of these
capabilities, and therefore custom definition is needed.
The capability strings @samp{setrgbb} and @samp{setrgbf} are expected to
take three 8-bit values as arguments. They are supported by Emacs 31.1
and newer (and some other applications).
@example
$ cat terminfo-custom.src
xterm-truecolor|xterm with 24-bit true color,
use=xterm-256color,
Tc,
setrgbb=\E[48\:2\:\:%p1%d\:%p2%d\:%p3%dm,
setrgbf=\E[38\:2\:\:%p1%d\:%p2%d\:%p3%dm,
$ tic -x -o ~/.terminfo terminfo-custom.src
$ TERM=xterm-truecolor emacs -nw
@end example
Some terminal emulators bundle their own custom definition that include
the @samp{setrgbb}, @samp{setrgbf} and @samp{Tc} capabilities.
The capability strings @samp{setb24} and @samp{setf24} are expected to
take one 24-bit pixel value as argument and transform the pixel to a
string that can be used to send 24-bit colors to the terminal. They are
only know to be supported by Emacs. They are made obsolete by
@samp{setrgbb} and @samp{setrgbf}, and may be removed in a future
version of Emacs.
@example
$ cat terminfo-custom.src
@ -1977,8 +2003,9 @@ 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
always use custom terminal definition with @samp{setb24} and
@samp{setf24}.
always use custom terminal definition with @samp{setrgbb} and
@samp{setrgbf}, @samp{setb24} and @samp{setf24}, @samp{Tc} without
@samp{RGB}, or @env{COLORTERM}=@samp{truecolor} without @samp{RGB}.
@node Debugging a customization file
@section How do I debug an init file?