Skip to content

Commit

Permalink
Add support for alert (blink) colors.
Browse files Browse the repository at this point in the history
This allows us to use alert$colorname as a neomutt color.

Example usage:

color header alertred default "^(x-mailer): .*apple|.*iphone"
  • Loading branch information
parazyd authored and flatcap committed Mar 8, 2018
1 parent efe8a33 commit 23c7629
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 13 additions & 2 deletions color.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,19 @@ void mutt_free_color(int fg, int bg)
static int parse_color_name(const char *s, int *col, int *attr, int is_fg, struct Buffer *err)
{
char *eptr = NULL;
int is_bright = 0;
int is_alert = 0, is_bright = 0;

if (mutt_str_strncasecmp(s, "bright", 6) == 0)
{
is_bright = 1;
s += 6;
}
else if (mutt_str_strncasecmp(s, "alert", 5) == 0)
{
is_alert = 1;
is_bright = 1;
s += 5;
}

/* allow aliases for xterm color resources */
if (mutt_str_strncasecmp(s, "color", 5) == 0)
Expand All @@ -411,7 +417,12 @@ static int parse_color_name(const char *s, int *col, int *attr, int is_fg, struc

if (is_bright)
{
if (is_fg)
if (is_alert)
{
*attr |= A_BOLD;
*attr |= A_BLINK;
}
else if (is_fg)
{
*attr |= A_BOLD;
}
Expand Down
4 changes: 3 additions & 1 deletion doc/manual.xml.head
Original file line number Diff line number Diff line change
Expand Up @@ -4197,7 +4197,9 @@ folder-hook work "set sort=threads"
<emphasis>foreground</emphasis> can optionally be prefixed with the
keyword
<literal>bright</literal> to make the foreground color boldfaced (e.g.,
<literal>brightred</literal>).</para>
<literal>brightred</literal>).
<literal>alert</literal> to make a blinking/alert color (e.g.,
<literal>alertred</literal>).</para>
<para>If your terminal supports it, the special keyword
<emphasis>default</emphasis> can be used as a transparent color. The value
<emphasis>brightdefault</emphasis> is also valid. If NeoMutt is linked
Expand Down

0 comments on commit 23c7629

Please sign in to comment.