8000 24-bit true color support · Issue #1364 · weechat/weechat · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
24-bit true color support #1364
Open
Open
@sim642

Description

@sim642

Throughout the years, 24-bit true color support has been asked about in #weechat but no issue exists about it.

General resources about terminal 24-bit true color support:

Issues

WeeChat relies on ncurses to handle the terminal and ncurses relies on terminfo to produce the right escapes. According to the true color gist, ncurses 6.1 supposedly supports it but practically it doesn't seem like it, which is likely why there's exactly zero documentation, tutorials or examples about it.

The current possibilities seem to be:

  1. Use a -direct TERM, e.g. xterm-direct.
    In this terminfo, the 16M colors are simply encoded sequentially into the standard terminal color numbering and terminfo conditionally uses the 24-bit color escape instead. Technically this should allow using them through ncurses just under color numbers including above 255 (I didn't actually test this).

    However, the extended numbering is inconsistent and plain stupid. Increasing terminal color extensions provide the following:

    • xterm has: 8 basic colors + 8 bright colors.
    • xterm-256color has: 8 basic colors + 8 bright colors + 216 color cube + 24 grayscale colors.
    • xterm-direct has: 8 basic colors + 16M true colors.

    While xterm-256color is backwards compatible with xterm (it keeps all the original colors and just adds new ones), xterm-direct is incompatible with both xterm-256color and xterm because it removes the bright colors, color cube and grayscale colors and replaces them with the beginning of true colors. Technically it works, but it's incredibly stupid on terminfo's part: any application that previously used bright colors or 256 colors extension will just show them as (almost) blacks in the true color scheme. This is so annoying that it's hard to imagine anyone actually wanting to use xterm-direct because it makes every terminal program that isn't 24-bit color compatible but uses more than the basic 8 colors unusable and ugly.

    This has also been a major point brought up in the gist discussion. In a sensible world xterm-direct would have: 8 basic colors + 8 bright colors + 216 color cube + 24 grayscale colors + 16M true colors. It's yet to be seen if and in how many years this gets improved to make any sense.

  2. Use terminal palette modification (via can_change_color and init_color).
    Ncurses has even before had the commands to modify RGB values of the 256-color palette in the (possibly rare) cases where it actually is supported. This just means that the existing standard 256-color palette would be replaced with some other colors but that's far from ideal:

    • Redefining a color means that the standard color of that color number isn't usable anymore and would also suddenly change.
    • Still limited by 256 different colors in the palette.
    • WeeChat would have to, in addition to the color pairs table, also manage a colors table to track which colors have been redefined to which RGB values and use them correctly.
    • Changing the palette has nothing to do with the actual 24-bit color escapes even (?).

WeeChat changes

If there's a solution to the above issues, then WeeChat would still require some changes to make it usable:


Other resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0