color now accepts zero or more attributes words before the foreground.
Also more or less resolves the issue that setting the color of an object
which defaults to underline/reverse is irreversible.
Co-authored-by: Richard Russon <rich@flatcap.org>
static int parse_color_pair(struct Buffer *buf, struct Buffer *s, int *fg,
int *bg, int *attr, struct Buffer *err)
{
- if (!MoreArgs(s))
+ while (true)
{
- mutt_buffer_printf(err, _("%s: too few arguments"), "color");
- return -1;
- }
+ if (!MoreArgs(s))
+ {
+ mutt_buffer_printf(err, _("%s: too few arguments"), "color");
+ return -1;
+ }
- mutt_extract_token(buf, s, 0);
+ mutt_extract_token(buf, s, 0);
- if (parse_color_name(buf->data, fg, attr, true, err) != 0)
- return -1;
+ if (mutt_str_strcasecmp("bold", buf->data) == 0)
+ *attr |= A_BOLD;
+ else if (mutt_str_strcasecmp("underline", buf->data) == 0)
+ *attr |= A_UNDERLINE;
+ else if (mutt_str_strcasecmp("none", buf->data) == 0)
+ *attr = A_NORMAL;
+ else if (mutt_str_strcasecmp("reverse", buf->data) == 0)
+ *attr |= A_REVERSE;
+ else if (mutt_str_strcasecmp("standout", buf->data) == 0)
+ *attr |= A_STANDOUT;
+ else if (mutt_str_strcasecmp("normal", buf->data) == 0)
+ *attr = A_NORMAL; /* needs use = instead of |= to clear other bits */
+ else
+ {
+ if (parse_color_name(buf->data, fg, attr, true, err) != 0)
+ return -1;
+ break;
+ }
+ }
if (!MoreArgs(s))
{
<arg choice="plain">
<replaceable class="parameter">object</replaceable>
</arg>
+ <arg choice="opt" rep="repeat">
+ <replaceable class="parameter">attribute</replaceable>
+ </arg>
<arg choice="plain">
<replaceable class="parameter">foreground</replaceable>
</arg>
<option>body</option>
</arg>
</group>
+ <arg choice="opt" rep="repeat">
+ <replaceable class="parameter">attribute</replaceable>
+ </arg>
<arg choice="plain">
<replaceable class="parameter">foreground</replaceable>
</arg>
<arg choice="plain">
<option>index-object</option>
</arg>
+ <arg choice="opt" rep="repeat">
+ <replaceable class="parameter">attribute</replaceable>
+ </arg>
<arg choice="plain">
<replaceable class="parameter">foreground</replaceable>
</arg>
<arg choice="plain">
<replaceable class="parameter">composeobject</replaceable>
</arg>
+ <arg choice="opt" rep="repeat">
+ <replaceable class="parameter">attribute</replaceable>
+ </arg>
<arg choice="plain">
<replaceable class="parameter">foreground</replaceable>
</arg>
</para>
</listitem>
</itemizedlist>
+ <para>
+ <emphasis>attribute</emphasis> can be one of the following:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>none</para>
+ </listitem>
+ <listitem>
+ <para>bold</para>
+ </listitem>
+ <listitem>
+ <para>underline</para>
+ </listitem>
+ <listitem>
+ <para>reverse</para>
+ </listitem>
+ <listitem>
+ <para>standout</para>
+ </listitem>
+ </itemizedlist>
<para>
<emphasis>foreground</emphasis> and <emphasis>background</emphasis> can
be one of the following:
</group>
</cmdsynopsis>
<para>
- For <emphasis>object</emphasis>, see the <command>color</command>
- command. <emphasis>attribute</emphasis> can be one of the following:
+ For <emphasis>object</emphasis>, <emphasis>composeobject</emphasis>, and
+ <emphasis>attribute</emphasis>, see the <command>color</command> command.
</para>
- <itemizedlist>
- <listitem>
- <para>
- none
- </para>
- </listitem>
- <listitem>
- <para>
- bold
- </para>
- </listitem>
- <listitem>
- <para>
- underline
- </para>
- </listitem>
- <listitem>
- <para>
- reverse
- </para>
- </listitem>
- <listitem>
- <para>
- standout
- </para>
- </listitem>
- </itemizedlist>
</sect1>
<sect1 id="msg-hdr-display">
<arg choice="plain">
<replaceable class="parameter">object</replaceable>
</arg>
+ <arg choice="opt" rep="repeat">
+ <replaceable class="parameter">attribute</replaceable>
+ </arg>
<arg choice="plain">
<replaceable class="parameter">foreground</replaceable>
</arg>
<option>body</option>
</arg>
</group>
+ <arg choice="opt" rep="repeat">
+ <replaceable class="parameter">attribute</replaceable>
+ </arg>
<arg choice="plain">
<replaceable class="parameter">foreground</replaceable>
</arg>
<arg choice="plain">
<option>index</option>
</arg>
+ <arg choice="opt" rep="repeat">
+ <replaceable class="parameter">attribute</replaceable>
+ </arg>
<arg choice="plain">
<replaceable class="parameter">foreground</replaceable>
</arg>
.
.PP
.nf
-\fBcolor\fP \fIobject\fP \fIforeground\fP \fIbackground\fP
-\fBcolor\fP { header | body } \fIforeground\fP \fIbackground\fP \fIregex\fP
-\fBcolor\fP index-object \fIforeground\fP \fIbackground\fP \fIpattern\fP
-\fBcolor\fP compose \fIcomposeobject\fP \fIforeground\fP \fIbackground\fP
+\fBcolor\fP \fIobject\fP [ \fIattribute\fP ... ] \fIforeground\fP \fIbackground\fP
+\fBcolor\fP { header | body } [ \fIattribute\fP ... ] \fIforeground\fP \fIbackground\fP \fIregex\fP
+\fBcolor\fP index-object [ \fIattribute\fP ... ] \fIforeground\fP \fIbackground\fP \fIpattern\fP
+\fBcolor\fP compose \fIcomposeobject\fP [ \fIattribute\fP ... ] \fIforeground\fP \fIbackground\fP
\fBuncolor\fP { index-object | header | body } { \fB*\fP | \fIpattern\fP ... }
.fi
.IP
.BR white ", "
.BR color\fIN\fP "."
.IP
+Valid attributes include:
+.BR none ", " bold ", " underline ", "
+.BR reverse ", and " standout .
+IP
The \fBuncolor\fP command can be applied to the index, header and body objects
only. It removes entries from the list. You must specify the same \fIpattern\fP
specified in the \fBcolor\fP command for it to be removed. The pattern
\fBunmono\fP { index-object | header | body } { \fB*\fP | \fIpattern\fP ... }
.fi
.IP
-For terminals which don't support color, you can still assign \fIattribute\fPs
-to objects (see \fBcolor\fP command above). Valid attributes include:
-.BR none ", " bold ", " underline ", " reverse ", and " standout "."
+For terminals which don't support color, you can still assign
+attributes to objects.
.
.PP
.nf