nano-devel
[Top][All Lists]
Advanced

[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: Mon, 19 Feb 2018 18:09:06 -0700

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.


> When I put this in my nanorc (index 23 is a dark cyanish color on my
> terminal):
> 
>   set selectedcolor brightwhite,23
> 
> nano responds with:
> 
> Error in /home/ben/.nanorc on line 170: A background color cannot be
> bright

That is a bug, but it highlighted an issue with converting 8-15 to 0-7 and 
setting bright flag. 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?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]