[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: |
Brand Huntsman |
Subject: |
Re: [Nano-devel] [PATCH] index/RGB colors and italic/reverse/underline attributes |
Date: |
Tue, 20 Feb 2018 04:03:29 -0700 |
On Tue, 20 Feb 2018 11:27:15 +0100
Benno Schulenberg <address@hidden> wrote:
> > 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?
+ unsigned char g_shades[4] = {0, 68, 176, 255};
+ /* black - 13% / 35% / 36% / 16% - white */
There are 3 mid-points between the 4 numbers. Lets say the first mid-point is
at 34 (half way between 0 and 68), and 34/255 = 13%. The darkest 13% of
grayscale values are mapped to 0. And the brightest 16% are mapped to 3. The
0-3 is an index into g_codes. c_shades[] is the same way, except it has 0-4
indices into _low_color_cube[].
The g_shades/c_shades for 88/256 is defined by the standard, and I didn't
comment them because we shouldn't be changing those values. The ones for 8/16
were chosen by me to get a good distribution of shades, and could be tweaked if
needed.
> > 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.
What are your thoughts on requiring ":namedcolor" after index and RGB colors?
We would still need to pass the fg/bg flag to color_to_short() but instead of
clamping the background color for 8-color terminals it would use "namedcolor".
- Re: [Nano-devel] [PATCH] index/RGB colors and italic/reverse/underline attributes, David Ramsey, 2018/02/15
- Re: [Nano-devel] [PATCH] index/RGB colors and italic/reverse/underline attributes, David Ramsey, 2018/02/15
- Re: [Nano-devel] [PATCH] index/RGB colors and italic/reverse/underline attributes, David Ramsey, 2018/02/18
- Re: [Nano-devel] [PATCH] index/RGB colors and italic/reverse/underline attributes, David Ramsey, 2018/02/18
- Re: [Nano-devel] [PATCH] index/RGB colors and italic/reverse/underline attributes, David Ramsey, 2018/02/19