changeset: 6549:960017a249f7
user: S. Gilles <[email protected]>
date: Mon Jan 04 13:57:40 2016 -0800
link: http://dev.mutt.org/hg/mutt/rev/960017a249f7
Prefer bright versions (8-15) of colors for brightXXX backgrounds.
When a bright color is specified as a background, try to use the
bright version of that color, falling back to the A_BLINK method only
on terms which do not support enough colors.
diffs (63 lines):
diff -r d3f31cf9239e -r 960017a249f7 color.c
--- a/color.c Fri Jan 01 12:24:53 2016 -0800
+++ b/color.c Mon Jan 04 13:57:40 2016 -0800
@@ -306,13 +306,14 @@
#ifdef HAVE_COLOR
static int
-parse_color_name (const char *s, int *col, int *attr, int brite, BUFFER *err)
+parse_color_name (const char *s, int *col, int *attr, int is_fg, BUFFER *err)
{
char *eptr;
+ int is_bright = 0;
if (ascii_strncasecmp (s, "bright", 6) == 0)
{
- *attr |= brite;
+ is_bright = 1;
s += 6;
}
@@ -334,6 +335,24 @@
return (-1);
}
+ if (is_bright)
+ {
+ if (is_fg)
+ {
+ *attr |= A_BOLD;
+ }
+ else if (COLORS < 16)
+ {
+ /* A_BLINK turns the background color brite on some terms */
+ *attr |= A_BLINK;
+ }
+ else
+ {
+ /* Advance the color by 8 to get the bright version */
+ *col += 8;
+ }
+ }
+
return 0;
}
@@ -615,7 +634,7 @@
mutt_extract_token (buf, s, 0);
- if (parse_color_name (buf->data, fg, attr, A_BOLD, err) != 0)
+ if (parse_color_name (buf->data, fg, attr, 1, err) != 0)
return (-1);
if (! MoreArgs (s))
@@ -626,7 +645,7 @@
mutt_extract_token (buf, s, 0);
- if (parse_color_name (buf->data, bg, attr, A_BLINK, err) != 0)
+ if (parse_color_name (buf->data, bg, attr, 0, err) != 0)
return (-1);
return 0;