5.1 More accurate colors in terminal emulators

[ This is based on partial information. Please help verify and/or expand these findings. ]

The graphical version of Emacs can reproduce color values accurately. Whereas things get more tricky when Emacs is used in a terminal emulator, because the terminals’ own capabilities determine the number of colors that may be displayed: the Modus themes don’t look as good in that case.

There is, however, a way to instruct supported terminal emulators to use more accurate colors. In a shell prompt type ‘toe -a | grep direct’ to get a list of relevant terminfo entries. There should be items such as ‘xterm-direct’, ‘alacritty-direct’, ‘kitty-direct’. Once you find the one that corresponds to your terminal, call Emacs with an environment variable like ‘TERM=xterm-direct’. Example that can be adapted to shell aliases:

TERM=xterm-direct emacsclient -nw

Another example that can be bound to a key:

TERM=xterm-direct uxterm -e emacsclient -nw