On 2014-10-27 21:11, k...@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


Reply via email to