It's a common confusion about terminal colors... Actually we have this:
- plain ascii
- ansi escape codes (16 color codes with bold/italic and background)
- 256 color palette (216 colors + 16 gray + ansi) (colors are 24bit)
- 24bit true color ("888" colors (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
The 256 color palete is configured at start, and it's a 666 cube of colors, each of them defined as a 24bit (888 rgb) color.
This means that current support can only display 256 different colors in the terminal, while truecolor means that you can display 16 milion different colors at the same time.
Truecolor escape codes doesnt uses a color palete. It just specifies the color itself.
Here's a test case:
printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"
- or https://raw.githubusercontent.com/JohnMorales/dotfiles/master/colors/24-bit-color.sh
- or http://github.com/robertknight/konsole/tree/master/tests/color-spaces.pl
- or https://git.gnome.org/browse/vte/tree/perf/img.sh?h=vte-0-36
Keep in mind that it is possible to use both ';' and ':' as parameters delimiter.
According to Wikipedia[1], this is only supported by xterm and konsole.
[1] https://en.wikipedia.org/wiki/ANSI_color
Currently, there is no support for the 24-bit color descriptions in the terminfo/termcap database and utilites. See the discussion thread here: https://lists.gnu.org/archive/html/bug-ncurses/2013-10/msg00007.html
- st (from suckless) [delimeter: semicolon] - http://lists.suckless.org/dev/1307/16688.html
- konsole [delimeter: colon, semicolon] - https://bugs.kde.org/show_bug.cgi?id=107487
- iterm2 [delimeter: colon, semicolon] - only in the nighties https://code.google.com/p/iterm2/issues/detail?id=218
- qterminal [delimeter: semicolon] - lxqt/qterminal#78
- Tera Term [delimeter: colon, semicolon] - Windows platform
- ConEmu [delimeter: semicolon] - Windows platform
- FinalTerm [delimeter: semicolon] - abandoned, iTerm2 borrowing it's ideas and features.
- mintty [delimeter: semicolon] Cygwin and MSYS/MSYS2 since commit https://github.com/mintty/mintty/commit/43f0ed8a46c6549cb9a3ea27abc057b5abe13bdb (2.0.1 release) - Windows platform
- all libvte based terminals (since 0.36 version) [delimeter: colon, semilocon] - https://bugzilla.gnome.org/show_bug.cgi?id=704449
- libvte-based Gnome Terminal
- libvte-based sakura
- libvte-based Terminator - use GTK+3 version.
- libvte-based Lilyterm - since commit https://github.com/Tetralet/LilyTerm/commit/72536e7ba448ad9ef1126ce45fbde3a3407a271b
- libvte-based ROXTerm
- libvte-based evilvte - no release yet, version from git https://github.com/caleb-/evilvte
- libvte-based Termit
- libvte-based Termite
- libvte-based Tilda
- libvte-based tinyterm
- libvte-based lxterminal - with --enable-gtk3 configure flag.
- libvte-based mlterm - with --with-gtk=3.0 configure flag
But there are bunch of libvte-based terminals for GTK2 so they are listed in the another section.
- xterm (though doing it wrong: "it uses nearest colour in RGB colour space, with a usualfalse assumption about orthogonal axes")
Note about colour differences: a) RGB axes are not orthogonal, so you cannot use sqrt(R^2+G^2+B^2) formula, b) for colour differences there is more correct (but much more complex) CIEDE2000 formula (which may easily blow up performance if used blindly) [2].
[2] neovim/neovim#793 (comment)
- urxvt (patched version [3] available) - http://lists.schmorp.de/pipermail/rxvt-unicode/2013q3/001826.html
- Terminology (E17) - https://phab.enlightenment.org/T746
- mrxvt (looks abandoned) - https://sourceforge.net/p/materm/feature-requests/41/
- aterm (looks abandoned) - https://sourceforge.net/p/aterm/feature-requests/23/
- fbcon (from linux kernel) - https://bugzilla.kernel.org/show_bug.cgi?id=79551
- FreeBSD console - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191652
- PuTTY (patched version [4] {xterm-like approximation to 256 colors} and [5] {real true colors} available) - Windows platform
- libvte and GTK2 - based:
- libvte-based GTKTerm2
- libvte-based stjerm - stjerm/stjerm#39
- libvte-based xfce4-terminal - will be solved automatically since Xfce slowly migrating to the GTK+3
[3] You can download patched version here https://github.com/spudowiar/rxvt-unicode/tree/24bit
[4] You can download patched version here https://github.com/rdebath/PuTTY
[5] You can download patched version here https://github.com/halcy/PuTTY
- tmux (have workaround[6] and patch[7]) - tmux/tmux#34 Older: https://sourceforge.net/p/tmux/tickets/140/ and https://www.mail-archive.com/[email protected]/msg04720.html
- screen
[6] Currently you can use tmux_escape option as a workaround if you want true color in shell run under tmux. No true color in tmux statusline though.
[7] You can see the patch here https://gist.github.com/JohnMorales/0579990993f6dec19e83
Supporting True Color:
- irssi - irssi/irssi#48
- neovim - https://github.com/neovim/neovim/commit/8dd415e887923f99ab5daaeba9f0303e173dd1aa
- elinks - http://repo.or.cz/w/elinks.git/blob/HEAD:/configure.in#l1410 (./configure --enable-true-color)
Not supporting True Color:
- mutt - http://dev.mutt.org/trac/ticket/3674
- mc - http://www.midnight-commander.org/ticket/3145#comment:1 - demo patches attached
- s-lang library - http://lists.jedsoft.org/lists/slang-users/2014/0000002.html
- ncurses library - https://lists.gnu.org/archive/html/bug-ncurses/2013-10/msg00007.html
- termbox library - nsf/termbox#37
- mcabber - https://bitbucket.org/McKael/mcabber-crew/issue/126/support-for-true-color-16-millions-colors
- emacs - http://emacs.1067599.n5.nabble.com/RFC-Add-tty-True-Color-support-td299962.html and http://emacs.1067599.n5.nabble.com/bug-20243-True-color-terminal-support-tc354040.html
- vim - https://bitbucket.org/ZyX_I/vim/commits/branch/24-bit-xterm
- tig - jonas/tig#227