The following terminal emulator programs support 256 colors and set
TERM=xterm-256color accordingly:
gnome-terminal, tilda.
rxvt-unicode (sets TERM=rxvt-unicode-256color).
st (sets TERM=st-256color).
QTerminal.
Terminal, iTerm2.
The following terminal emulator programs support 256 colors. You only
need to set TERM=xterm-256color or similar; the programs by default
set TERM to a value that supports only 8 colors.
xterm is in many cases built with support for 256 colors. But it
sets TERM=xterm. You need to set TERM=xterm-256color.
guake (sets TERM=xterm). You need to set
TERM=xterm-256color.
konsole (sets TERM=xterm). You need to set
TERM=xterm-256color or TERM=konsole-256color.
yakuake (sets TERM=xterm). You need to set
TERM=xterm-256color.
Eterm (sets TERM=Eterm). You need to set
TERM=Eterm-256color.
mlterm (sets TERM=mlterm). You need to set
TERM=mlterm-256color.
PuTTY (sets TERM=xterm). You need to set
TERM=xterm-256color or TERM=putty-256color.
TeraTerm (sets TERM=xterm). You need to set
TERM=xterm-256color.
A couple of terminal emulator programs support even the entire RGB color space (16 million colors). To get this to work, at this date (2019), you need three things:
ncurses library version 6.1 or newer must be installed.
TERM environment variable to the corresponding
value:
TERM=xterm-direct instead of
TERM=xterm or TERM=xterm-256color,
TERM=konsole-direct in konsole,
TERM=st-direct in st,
TERM=mlterm-direct in mlterm,
or TERM=iterm2-direct in iTerm2 on macOS.