Bug 79551 - True Color (24 bit per color or 16 millon of them) support for fbcon
Summary: True Color (24 bit per color or 16 millon of them) support for fbcon
Status: RESOLVED CODE_FIX
Alias: None
Product: Other
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 enhancement
Assignee: other_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-06 09:52 UTC by Anton Kochkov
Modified: 2019-11-19 04:52 UTC (History)
2 users (show)

See Also:
Kernel Version: latest
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Anton Kochkov 2014-07-06 09:52:13 UTC
Here's a test case:

printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"

* 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

According to Wikipedia[1], this is only supported by xterm and konsole.

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+16gray + ansi) (colors are 24bit)
* 24bit true color (888 colors (aka 16 milion)

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.

[1] https://en.wikipedia.org/wiki/ANSI_color

Here are terminals discussions:
==============================

Now supporting truecolor
------------------------

* st (from suckless) -  http://lists.suckless.org/dev/1307/16688.html
* konsole - https://bugs.kde.org/show_bug.cgi?id=107487
* iterm2 - https://code.google.com/p/iterm2/issues/detail?id=218
* all libvte based terminals:  https://bugzilla.gnome.org/show_bug.cgi?id=704449
    * Gnome Terminal
    * sakura
    * Terminator
    * Lilyterm
    * ROXTerm
    * evilvte
    * Termit
    * Tilda
    * stjerm
    * tinyterm
    * GTKTerm2

Parsing ANSI color sequences, but approximating them to 256 palette:
--------------------------------------------------------------------

* xterm
* mlterm - http://sourceforge.net/mailarchive/message.php?msg_id=31828705

NOT supporting truecolor:
-----------------------------

* urxvt -  http://lists.schmorp.de/pipermail/rxvt-unicode/2013q3/001826.html 
* Terminlogy (E17) - https://phab.enlightenment.org/T746
* mrxvt - https://sourceforge.net/p/materm/feature-requests/41/
* aterm - https://sourceforge.net/p/aterm/feature-requests/23/

Here are another console programs discussions:
============================================

* mutt - http://dev.mutt.org/trac/ticket/3674
* mc - http://www.midnight-commander.org/ticket/3145#comment:1
* s-lang library - http://lists.jedsoft.org/lists/slang-users/2014/0000001.html
* ncurses library - https://lists.gnu.org/archive/html/bug-ncurses/2013-10/msg00007.html
* 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
* vim - https://bitbucket.org/ZyX_I/vim/commits/branch/24-bit-xterm
* tig - https://github.com/jonas/tig/issues/227
Comment 1 Anton Kochkov 2017-09-15 17:49:42 UTC
Sorry for spamming, but now, 3 years after situation has changed and more programs/terminal emulators supports this mode (see my gist for periodical updates https://gist.github.com/XVilka/8346728 ):

--------------------------------------------------

Currently, there is no support for the 24-bit colour 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
Detection

There's no reliable way, and ncurses/terminfo's maintainer expressed he has no intent on introducing support. S-Lang author added a check for $COLORTERM containing either "truecolor" or "24bit" (case sensitive). In turn, VTE, Konsole and iTerm2 set this variable to "truecolor" (it's been there in VTE for a while, it's relatively new and maybe still git-only in Konsole and iTerm2).

This is obviously not a reliable method, and is not forwarded via sudo, ssh etc. However, whenever it errs, it errs on the safe side: does not advertise support whereas it's actually supported. App developers can freely choose to check for this same variable, or introduce their own method (e.g. an option in their config file), whichever matches better the overall design of the given app. Checking $COLORTERM is recommended though, since that would lead to a more unique desktop experience where the user has to set one variable only and it takes effect across all the apps, rather than something separately for each app.
Here are terminals discussions:
Now supporting truecolour

    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] - since v3 version
    qterminal [delimeter: semicolon] - https://github.com/qterminal/qterminal/issues/78
    alacritty [delimeter: semicolon] - written in Rust
    kitty [delimeter: semicolon] - uses OpenGL
    cool-retro-term [delimeter: semicolon]
    Termux [delimeter: semicolon] - Android platform
    Black Screen [delimeter: semicolon] - crossplatform, HTML/CSS/JS-based
    Hyper.app [delimeter: semicolon] - crossplatform, HTML/CSS/JS-based (Electron)
    hterm - HTML/CSS/JS-based (ChromeOS)
    Tera Term [delimeter: colon, semicolon] - Windows platform
    ConEmu [delimeter: semicolon] - Windows platform
    FinalTerm [delimeter: semicolon] - abandoned, iTerm2 borrowing it's ideas and features.
    MacTerm [delimeter: semicolon] - Mac OS X platform
    mintty [delimeter: semicolon] Cygwin and MSYS/MSYS2 since commit https://github.com/mintty/mintty/commit/43f0ed8a46c6549cb9a3ea27abc057b5abe13bdb (2.0.1 release) - Windows platform
    Windows 10 bash console, since Windows Insiders build 14931
    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 xfce4-terminal - since 0.6.90 release, if compiled with GTK+3
        libvte-based Terminator - since 1.90 release
        libvte-based Tilix - written in D. Similar user interface as for Terminator.
        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 Pantheon Terminal
        libvte-based lxterminal - with --enable-gtk3 configure flag.

But there are bunch of libvte-based terminals for GTK2 so they are listed in the another section.

Also, while this one is not exactly a terminal, but a terminal replayer, it still worth mentioning:

    asciinema player: https://github.com/asciinema/asciinema-player

Improper support for true colors

    mlterm - build with --with-gtk=3.0 configure flag - approximates colors to 512 embedded palette https://sourceforge.net/p/mlterm/bugs/74/

Parsing ANSI colour sequences, but approximating them to 256 palette

    xterm (though doing it wrong: "it uses nearest colour in RGB colour space, with a usualfalse assumption about orthogonal axes")
    urxvt aka rxvt-unicode - since Revision 1.570 http://lists.schmorp.de/pipermail/rxvt-unicode/2016q2/002261.html (Note there is a restriction of colors count at once still)
    linux console (since v3.16): https://github.com/torvalds/linux/commit/cec5b2a97a11ade56a701e83044d0a2a984c67b4

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] https://github.com/neovim/neovim/issues/793#issuecomment-48106948
Terminal multiplexers

    tmux - starting from version 2.2 (support since 427b820...)
    screen - has support in 'master' branch, need to be enabled (see 'truecolor' option)
    pymux - tmux clone in pure Python (to enable truecolour run pymux with --truecolor option)
    dvtm - not yet supporting True Colour https://github.com/martanne/dvtm/issues/10

NOT supporting truecolour

    Terminology (Enlightenment) - https://phab.enlightenment.org/T746
    mosh (Mobile SHell) - https://github.com/mobile-shell/mosh/issues/649
    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
    yaft framebuffer terminal - https://github.com/uobikiemukot/yaft/issues/12
    PuTTY (patched version [3] {xterm-like approximation to 256 colors} and [4] {real true colors} available) - Windows platform
    KiTTY - Windows platform
    MTPuTTY - Windows platform
    mRemoteNG - Windows platform - https://github.com/mRemoteNG/mRemoteNG/issues/717
    ConnectBot - https://github.com/connectbot/connectbot/pull/531 - Android platform
    JuiceSSH - Adroid platform, closed source
    Termius - Linux, Windows, OS X platforms, closed source
    SmarTTY - Windows platform - closed source (sent them a request)
    Netsarang XShell - closed source (sent them an email)
    MobaXterm Windows platform - closed source (sent them an email)
    libvte and GTK2 - based:
        libvte-based GTKTerm2
        libvte-based stjerm (looks abandoned) - https://github.com/stjerm/stjerm/issues/39

[3] You can download patched version here https://github.com/rdebath/PuTTY

[4] You can download patched version here https://github.com/chrisbra/putty/commits/truecolor (based on the patches from https://github.com/halcy/PuTTY )
Here are another console programs discussions:

Supporting True Colour:

    Eternal Terminal - automatically reconnecting shell
    mc - since 682a5.... See also ticket #3724 for truecolor themes.
    irssi - since PR #48
    neovim - since commit 8dd415e887923f99ab5daaeba9f0303e173dd1aa; need to set termguicolors to enable true color.
    vim - (from 7.4.1770) since commit 8a633e3427b47286869aa4b96f2bfc1fe65b25cd; need to set termguicolors to enable true color.
    emacs - since commit e463e57..., require custom terminfo
    elinks - configure.in:1410 (./configure --enable-true-color)
    s-lang library - (since pre2.3.1-35, for 64bit systems)
    timg - Terminal Image Viewer
    tv - tool to quickly view high-resolution multi-band imagery directly in terminal
    termimage - terminal image viewer
    explosion - terminal image viewer
    ls-icons - fork of coreutils with ls program that supports icons
    mpv - video player with support of console-only output (since https://github.com/mpv-player/mpv/commit/dd02369c3223fda5bcb2658b15404d43232bb38f)
    radare2 - reverse engineering franework; since be46b9... commit.

Not supporting True Colour:

    mutt - http://dev.mutt.org/trac/ticket/3674
    neomutt - https://github.com/neomutt/neomutt/issues/85
    ncurses library - https://lists.gnu.org/archive/html/bug-ncurses/2013-10/msg00007.html
    termbox library - https://github.com/nsf/termbox/issues/37
    mcabber - https://bitbucket.org/McKael/mcabber-crew/issue/126/support-for-true-color-16-millions-colors
    tig - https://github.com/jonas/tig/issues/227
    joe - https://sourceforge.net/p/joe-editor/patches/116/
Comment 2 Mike Frysinger 2018-06-08 18:47:47 UTC
have you tested the linux console support, or are you just going by what random pages (like wikipedia) say ?

looks to me like 8/24-bit color support (at least emulation) was added starting with linux-3.16:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cec5b2a97a11ade56a701e83044d0a2a984c67b4

it only supports the semi-colon delimited format though, so adding colon delimited support would be nice.
Comment 3 Anton Kochkov 2019-11-19 04:52:45 UTC
I clarified it in my repo - https://github.com/termstandard/colors

So now can be closed. Thanks for the clarification!

Note You need to log in before you can comment on or make changes to this bug.