[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [PATCH] index/RGB colors and italic/reverse/underline a
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] [PATCH] index/RGB colors and italic/reverse/underline attributes |
Date: |
Tue, 20 Feb 2018 11:27:15 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
Op 20-02-18 om 02:09 schreef Brand Huntsman:
> On Mon, 19 Feb 2018 14:07:39 +0100
> Benno Schulenberg <address@hidden> wrote:
>>> + unsigned char g_shades[4] = {0, 68, 176, 255};
>>> + /* black - 13% / 35% / 36% / 16% - white */
>>> +
>>> + unsigned char c_shades[5] = {0, 51, 127, 204, 255};
>>> + /* dark - 10% / 25% / 30% / 25% / 10% -
>>> bright */
>>
>> I don't understand these comments. How do the percentages relate to
>> the numbers?
>
> They represent what percentage of 0-255 channel values get mapped to
> 0-4, which then get looked up in the low color cube array.
I still don't see how the percentages relate to the numbers: 13% -> 0,
35% -> 68...? Are these comments in the right place?
> We will need to pass a second flag to color_to_short() that is set for fg but
> not for bg. If 8-color terminal it must either fail for 8-15 or clamp them to
> 0-7 without setting bright flag. So 15,9 and 15,1 always use a dark red
> background on 8-color terminals. Clamping would cause issues if fg color has
> low or no contrast with the clamped bg color. And not passing fg/bg flag to
> color_to_short() would cause 8-15 bg indices to fail on every terminal type.
> What should we do?
If the user uses color indexes, they have a specific terminal in mind. If
they then use the syntax on a different terminal, they get to live with any
resulting unreadability -- they should have used RGB values instead. So I
would say: clamp.
Benno
signature.asc
Description: OpenPGP digital signature