Re: [misc] [PATCH] Default (white) as foreground colour

On Wed, Dec 06, 2017 at 09:29:35AM +0100, Lukas Fleischer wrote:
> On Sun, 03 Dec 2017 at 10:17:13, Lars Henriksen wrote:
> > White could only with great difficulty be used as customized
> > foreground colour, because the colour pair COLR_CUSTOM then
> > was identical to COLR_DEFAULT (default on default). This made
> > it impossible to distinguish the selected element in lists.
> > 
> > The patch turns on A_BOLD when default (or white) is chosen
> > as foreground colour.
> > ---
> >  src/config.c | 1 +
> >  src/custom.c | 9 ++++++++-
> >  src/utils.c  | 7 +++++++
> >  3 files changed, 16 insertions(+), 1 deletion(-)
> > [...]
> > diff --git a/src/custom.c b/src/custom.c
> > index f528d32..1e5884f 100644
> > --- a/src/custom.c
> > +++ b/src/custom.c
> > @@ -58,7 +58,13 @@ static struct attribute attr;
> >   */
> >  void custom_init_attr(void)
> >  {
> > -       attr.color[ATTR_HIGHEST] = COLOR_PAIR(COLR_CUSTOM);
> > +       short col_fg;
> > +       pair_content(COLR_CUSTOM, &col_fg, NULL);
> > +
> > +       attr.color[ATTR_HIGHEST] =
> > +               (col_fg == COLOR_WHITE || col_fg == -1 || col_fg == 255) ?
> > +               COLOR_PAIR(COLR_CUSTOM) | A_BOLD :
> > +               COLOR_PAIR(COLR_CUSTOM);
> > [...]
> 
> I like the overall idea of this patch. However, is there any reason for
> making white a special case as well? We cannot assume that white is the
> "default foreground color". I, myself, am using a black on white
> terminal and others might be using green on black or even more exotic
> combinations.

Yes, you are right. This requires more testing on my part. I really should
have tried this out with other default values than white on black, and
white should not be treated differently.

Do you use default on default with the default values determined by the
terminal emulator?

Lars Henriksen

Links