From: Vincent Lefevre Date: Sat, 29 Dec 2018 18:37:57 +0000 (+0100) Subject: Added support for the "light" color prefix (in addition to "bright"). X-Git-Tag: mutt-1-12-rel~156 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7af70af5d94467d7833abf919297f1f4a615ad33;p=mutt Added support for the "light" color prefix (in addition to "bright"). At the same time, restrict the advance by 8 to colors in the range 0-7 and no longer use the blink attribute to emulate light background colors in some terminals (e.g. linux console and rxvt), as this is really blink in other terminals (e.g. xterm); light background colors can still be obtained by choosing a proper $TERM value (tested with linux console, using TERM=linux-16color, and rxvt). --- diff --git a/color.c b/color.c index af979dfc..892155a1 100644 --- a/color.c +++ b/color.c @@ -331,13 +331,18 @@ static int parse_color_name (const char *s, int *col, int *attr, int is_fg, BUFFER *err) { char *eptr; - int is_bright = 0; + int is_bright = 0, is_light = 0; if (ascii_strncasecmp (s, "bright", 6) == 0) { is_bright = 1; s += 6; } + else if (ascii_strncasecmp (s, "light", 5) == 0) + { + is_light = 1; + s += 5; + } /* allow aliases for xterm color resources */ if (ascii_strncasecmp (s, "color", 5) == 0) @@ -357,21 +362,33 @@ parse_color_name (const char *s, int *col, int *attr, int is_fg, BUFFER *err) return (-1); } - if (is_bright) + if (is_bright || is_light) { if (is_fg) { - *attr |= A_BOLD; - } - else if (COLORS < 16) - { - /* A_BLINK turns the background color brite on some terms */ - *attr |= A_BLINK; + if ((COLORS >= 16) && is_light) + { + if (*col < 8) + { + /* Advance the color 0-7 by 8 to get the light version */ + *col += 8; + } + } + else + { + *attr |= A_BOLD; + } } else { - /* Advance the color by 8 to get the bright version */ - *col += 8; + if (COLORS >= 16) + { + if (*col < 8) + { + /* Advance the color 0-7 by 8 to get the light version */ + *col += 8; + } + } } } diff --git a/doc/manual.xml.head b/doc/manual.xml.head index aef594d6..b53b19a0 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -2816,9 +2816,13 @@ be one of the following: -foreground can optionally be prefixed with the -keyword bright to make the foreground color boldfaced -(e.g., brightred). +The color name can optionally be prefixed with the keyword +bright or light to make the color +boldfaced or light (e.g., brightred). The precise +behavior depends on the terminal and its configuration. In particular, +the boldfaced/light difference and such background colors may be +available only for terminals configured with at least 16 colors, +as specified by the $TERM environment variable.