Re: [dev] [dvtm] Truecolor support

From: Paride Legovini <pl_AT_ninthfloor.org>
Date: Tue, 28 Oct 2014 00:23:08 +0800

On 2014-10-27 21:11, k0ga_AT_shike2.com wrote:
> Hi,
>
>> Apparently curses provides:
>>
>> int init_color(short color, short r, short g, short b);
>>
>> not quite sure what it does internally.
>
> There is no support for true color in terminfo, so curses cannot
> handle it. If your application need it the only way is to print
> directly the sequences, and the only way to detect if the terminal
> has this capability is to check TERM against a list of terminals
> that suppor it.

The SGR parameter that selects the foreground color has code 38. Its
arguments are 5;x where x is color index (0..255) or 2;r;g;b where r,g,b
are red, green and blue color channels (out of 255). Taking a look at
vt.c:444 of the latest git head we find:

case 38:
        if ((i + 2) < pcount && param[i + 1] == 5) {
                b->curfg = param[i + 2];
                i += 2;
        }
        break;

so, if the SGR code is 38 and its first argument is 5 the foreground
color is set. What we need here is a second check where if the first
parameter is 2 the control sequence is sent directly to the terminal.
I'm not sure about the best way to do this, as I don't think that we can
use put_wc(). Before going any further I'd like to hear Marc's opinion
about the issue.

An analogous change is needed for the background color (SGR code 45).

Paride
Received on Mon Oct 27 2014 - 17:23:08 CET

This archive was generated by hypermail 2.3.0 : Mon Oct 27 2014 - 17:24:14 CET