Re: [dev] Truecolor ST

From: pancake <pancake_AT_youterm.com>
Date: Thu, 18 Jul 2013 10:33:40 +0200

Sorry, I typed that by head. it's ;2; instead of ;5;

Here's a test case

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

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 (8*8*8 colors (aka 16 milion)

The 256 color palete is configured at start, and it's a 6*6*6 cube of
colors, each of them defined as a 24bit (8*8*8 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

On 07/17/13 21:34, Roberto E. Vargas Caballero wrote:
> On Wed, Jul 17, 2013 at 08:44:28PM +0200, pancake wrote:
>> I've been doing some ansi tests and found that only xterm (not urxvt, vte, iterm2,cmd.exe) supports truecolor ansi escape codes.
>>
>> It is documented in wikipedia, but afaik, only radare2 uses it (when enabled).
>>
>> Do you think that it should be implemented in st or we should stand supporting the most common scenarios?
>>
>> True RGB (24bit color) is constructed like this:
>>
>> \x1b[38;5;R;G;Bm
>>
>> Where 38 is fg (48 is bg)
>> And RGB are decimal (1-3chars) from 0-255
>
> Could you explain where did you find this information?, because
> I only can see:
>
> \x1b[38;5;color;m
>
> where color is an index between 0 and 255. This is the function
> implementeb by st:
>
>
>
> case 38:
> if(i + 2 < l && attr[i + 1] == 5) {
> i += 2;
> if(BETWEEN(attr[i], 0, 255)) {
> term.c.attr.fg = attr[i];
> } else {
> fprintf(stderr,
> "erresc: bad fgcolor %d\n",
> attr[i]);
> }
> } else {
> fprintf(stderr,
> "erresc(38): gfx attr %d unknown\n",
> attr[i]);
> }
> break;
>
>
>
> Best regards,
>
>
Received on Thu Jul 18 2013 - 10:33:40 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 18 2013 - 10:36:11 CEST