---
name: "aerc-stylesets"
section: "7"
platform: "linux"
package: "aerc"
version: "0.22.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/aerc-stylesets"
---

# aerc-stylesets(7)

styleset file specification for aerc(1)

## NAME

aerc-stylesets - styleset file specification for [**aerc**(1)](/aerc/1.md)

## SYNOPSIS

aerc uses a simple configuration syntax to configure the styleset for its ui.

## STYLESET CONFIGURATION

The styleset is described as **\<object\>**.**\<attribute\>** = *\<value\>* pairs.

For example, in the line below, the foreground color of the style object **msglist\_unread** is set to *cornflowerblue*

**msglist\_unread**.**fg** = *cornflowerblue*

The configuration also allows wildcard matching of the keys to configure multiple style objects at a time.

## ATTRIBUTES

The following options are available to be modified for each of the style objects.

**\<object\>**.**fg** = *\<color\>*

The foreground color of the style object is set.

**\<object\>**.**bg** = *\<color\>*

The background color of the style object is set.

**\<object\>**.**bold** = *true*\|*false*\|*toggle*

The bold attribute of the style object is set/unset.

**\<object\>**.**blink** = *true*\|*false*\|*toggle*

The blink attribute of the style object is set/unset. The terminal needs to support blinking text.

**\<object\>**.**underline** = *true*\|*false*\|*toggle*

The underline attribute of the style object is set/unset. The terminal needs to support underline text.

**\<object\>**.**italic** = *true*\|*false*\|*toggle*

The italic attribute of the style object is set/unset. The terminal needs to support italic text.

**\<object\>**.**dim** = *true*\|*false*\|*toggle*

The dim attribute of the style object is set/unset. The terminal needs to support half-bright text.

**\<object\>**.**reverse** = *true*\|*false*\|*toggle*

Reverses the color of the style object. Exchanges the foreground and background colors.

If the value is *false*, it doesn't change anything.

**\<object\>**.**normal** = true

All the attributes of the style object are unset.

The value doesn't matter.

**\<object\>**.**default** = true

Set the style object to the default style of the context. Usually based on the terminal.

The value doesn't matter.

## STYLE OBJECTS

The style objects represent the various ui elements or ui instances for styling.

| | |
| --- | --- |
| **Style Object** | **Description** |
| **default** | The default style object used for normal ui elements while not using specialized configuration. |
| **error** | The style used to show errors. |
| **warning** | The style used when showing warnings. |
| **success** | The style used for success messages. |
| **title** | The style object used to style titles in ui elements. |
| **header** | The style object used to style headers in ui elements. |
| **realname** | The style object used to style real name(s) in the email fields in the header section of the message viewer. |
| **email** | The style object used to style email(s) in the email fields in the header section of the message viewer. |
| **subject** | The style object used to style subject in the header section of the message viewer. |
| **date** | The style object used to style date in the header section of the message viewer. |
| **statusline\_default** | The default style applied to the statusline. |
| **statusline\_error** | The style used for error messages in statusline. |
| **statusline\_success** | The style used for success messages in statusline. |
| **msglist\_default** | The default style for messages in a message list. |
| **msglist\_unread** | Unread messages in a message list. |
| **msglist\_read** | Read messages in a message list. |
| **msglist\_flagged** | The messages with the flagged flag. |
| **msglist\_deleted** | The messages marked as deleted. |
| **msglist\_marked** | The messages with the marked flag. |
| **msglist\_result** | The messages which match the current search. |
| **msglist\_answered** | The messages marked as answered. |
| **msglist\_forwarded** | The messages marked as forwarded. |
| **msglist\_gutter** | The message list gutter. |
| **msglist\_pill** | The message list scrollbar. |
| **msglist\_thread\_folded** | Visible messages that have folded thread children. |
| **msglist\_thread\_context** | The messages not matching the mailbox / query, displayed for context. |
| **msglist\_thread\_orphan** | Threaded messages that have a missing parent message. |
| **dirlist\_default** | The default style for directories in the directory list. |
| **dirlist\_unread** | The style used for directories with unread messages |
| **dirlist\_recent** | The style used for directories with recent messages |
| **part\_switcher** | Background for the part switcher in the message viewer. |
| **part\_filename** | Attachment file name in the part switcher. |
| **part\_mimetype** | Attachment/part MIME type in the part switcher. |
| **completion\_default** | The default style for the completion engine. |
| **completion\_description** | Completion item descriptions. |
| **completion\_gutter** | The completion gutter. |
| **completion\_pill** | The completion pill. |
| **tab** | The style for the tab bar. |
| **stack** | The style for ui stack element. |
| **spinner** | The style for the loading spinner. |
| **border** | The style used to draw borders (only the **bg** color is used unless you customize **border-char-vertical** and/or **border-char-horizontal** in *aerc.conf*). |
| **selector\_default** | The default style for the selector ui element. |
| **selector\_focused** | The focused item in a selector ui element. |
| **selector\_chooser** | The item chooser in a selector ui element. |
| **keyhint\_default** | The default style for the keyhint popup background. |
| **keyhint\_key** | The style for the key column in the keyhint popup. |
| **keyhint\_desc** | The style for the description column in the keyhint popup. |

These next style objects only affect the built-in **colorize** filter and must be declared under a **\[viewer\]** section of the styleset file.

| | |
| --- | --- |
| **Style Object** | **Description** |
| **url** | URLs. |
| **header** | RFC-822-like header names. |
| **signature** | Email signatures. |
| **diff\_meta** | Patch diff meta lines. |
| **diff\_chunk** | Patch diff chunks. |
| **diff\_chunk\_func** | Patch diff chunk function names. |
| **diff\_add** | Patch diff added lines. |
| **diff\_del** | Patch diff deleted lines. |
| **diff\_whitespace** | Patch diff trailing whitespace. |
| **quote\_1** | First level quoted text. |
| **quote\_2** | Second level quoted text. |
| **quote\_3** | Third level quoted text. |
| **quote\_4** | Fourth level quoted text. |
| **quote\_x** | Above fourth level quoted text. |
| **code** | Code blocks fenced by \`\`\` and inline \`code\`. |

User defined styles can be used to style arbitrary strings in go-templates (see *.Style* in [**aerc-templates**(7)](/aerc-templates/7.md)). User styles must be defined in the *\[user\]* ini section. Styles can be referenced by their name (e.g. *red.fg* is named "red").

Example:

```
[user]
red.fg=red
```

User styles are layered with other styles applied to the context in which they are rendered. The user style colors (fg and/or bg) will only be effective if the context style does not define any. Other boolean attributes will be merged with the underlying style boolean attributes.

For example, if the context style is:

fg=red bold

And the inline style is:

fg=yellow italic underline

The effective style will be:

fg=red bold italic underline

## FNMATCH STYLE WILDCARD MATCHING

The styleset configuration can be made simpler by using the fnmatch style wildcard matching for the style object.

The special characters used in the fnmatch wildcards are:

| | |
| --- | --- |
| **Pattern** | **Meaning** |
| **\*** | Matches everything |
| **?** | Matches any single character |

For example, the following wildcards can be made using this syntax.

| | |
| --- | --- |
| **Example** | **Description** |
| **\***.**fg** = *blue* | Set the foreground color of all style objects to blue. |
| **\*list**.**bg** = *hotpink* | Set the background color of all style objects that end in list to hotpink. |

Note that the statements in a given styleset are parsed in the order in which they are written. That means that with the following styleset:

```
msglist_marked.fg = pink
msglist_*.fg = white
```

The **msglist\_marked.fg** attribute will be set to *white*.

## SELECTED MODIFIER

The **selected** modifier can be applied to any style object. The style provided for the **selected** modifier is applied on top of the style object it corresponds to.

If you would like to make sure messages that are flagged as read in the msglist appear in yellow foreground and black background, you can specify that with this:

**msglist\_default**.**selected**.**fg** = *yellow*

**msglist\_default**.**selected**.**bg** = *black*

If we specify the global style selected modifier using fnmatch as below:

**\***.**selected**.**reverse** = *toggle*

This toggles the reverse switch for selected version of all the style objects.

**selected** objects inherit from all attributes of their non-selected counterparts. **selected** statements are parsed after non-selected ones and effectively override the attributes of the non-selected style object.

## LAYERED STYLES

Some styles, (currently the **msglist\_\*** and **dirlist\_\*** ones) are applied in layers. If a style differs from the base (in this case **\*list\_default**) then that style applies, unless overridden by a higher layer. If **fg** and **bg** colors are not defined explicitly (or defined to the default color) they will be considered as "transparent" and the colors from the lower layer will be used instead.

The order that **msglist\_\*** styles are applied in is, from first to last:

- 1\.

  **msglist\_default**

- 2\.

  **msglist\_unread**

- 3\.

  **msglist\_read**

- 4\.

  **msglist\_answered**

- 5\.

  **msglist\_forwarded**

- 6\.

  **msglist\_flagged**

- 7\.

  **msglist\_deleted**

- 8\.

  **msglist\_result**

- 9\.

  **msglist\_thread\_folded**

- 10\.

  **msglist\_thread\_context**

- 11\.

  **msglist\_thread\_orphan**

- 12\.

  **msglist\_marked**

So, the marked style will override all other msglist styles.

The order for **dirlist\_\*** styles is:

- 1\.

  **dirlist\_default**

- 2\.

  **dirlist\_unread**

- 3\.

  **dirlist\_recent**

## DYNAMIC MESSAGE LIST STYLES

All **msglist\_\*** styles can be defined for specific email header values. The syntax is as follows:

**msglist\_\<name\>**.*\<header\>*,*\<header\_value\>*.**\<attribute\>** = *\<attr\_value\>*

If *\<header\_value\>* starts with a tilde character *~*, it will be interpreted as a regular expression. If you are writing regular expressions that try to match with *.* or *\\.* you need to wrap like this *~/\<expression\>/*.

*\<header\>,\<header\_value\>* can be specified multiple times to narrow down matches to more than one email header value. In that case, all given headers must match for the dynamic style to apply.

Examples:

```
msglist*.X-Sourcehut-Patchset-Update,APPROVED.fg = green
msglist*.X-Sourcehut-Patchset-Update,NEEDS_REVISION.fg = yellow
msglist*.X-Sourcehut-Patchset-Update,REJECTED.fg = red
"msglist_*.Subject,~^(\[[w-]+]\s*)?\[(RFC )?PATCH.fg" = #ffffaf
"msglist_*.Subject,~^(\[[w-]+]\s*)?\[(RFC )?PATCH.selected.fg" = #ffffaf
"msglist_*.From,~^Bob.Subject,~^(\[[w-]+]\s*)?\[(RFC )?PATCH.selected.fg" = #ffffaf
"msglist_*.List-ID,~/lists\.sr\.ht/selected.fg" = blue
```

When a dynamic style is matched to an email header, it will be used in priority compared to its non-dynamic counterpart. Provided the following styleset:

```
msglist_marked.fg = blue
msglist_*.Subject,~foobar.fg = red
```

An email with *foobar* in its subject will be colored in *red* all the time, since **msglist\_\*** also applies to **msglist\_marked**.

When multiple *\<header\>,\<header\_value\>* pairs are given, the last style which matches all given patterns will be applied. Provided the following styleset:

```
msglist_*.From,~^Bob.Subject,~foobar.fg = red
msglist_*.From,~^Bob.fg = blue
```

An email from *Bob* with *foobar* in its subject will be colored in *blue*, since the second style is a full match too.

## COLORS

The color values are set using any of the following methods:

*default*

The color is set as per the system or terminal default.

*\<Color name\>*

Any w3c approved color name is used to set colors for the style.

*\<Hex code\>*

Hexcode for a color can be used. The format must be *#XXXXXX*.

*\<Dec number\>*

Color based on the terminal palette index. Valid numbers are between *0* and *255*.

## DEFAULTS

Before parsing a styleset, it is first initialized with the following defaults:

```
*.selected.bg = 12
*.selected.fg = 15
*.selected.bold = true
statusline_*.dim = true
*warning.dim = false
*warning.bold = true
*warning.fg = 11
*success.dim = false
*success.bold = true
*success.fg = 10
*error.dim = false
*error.bold = true
*error.fg = 9
border.bg = 12
border.fg = 15
title.bg = 12
title.fg = 15
title.bold = true
header.fg = 4
header.bold = true
msglist_unread.bold = true
msglist_deleted.dim = true
msglist_marked.bg = 6
msglist_marked.fg = 15
msglist_pill.bg = 12
msglist_pill.fg = 15
part_mimetype.fg = 12
selector_chooser.bold = true
selector_focused.bold = true
selector_focused.bg = 12
selector_focused.fg = 15
completion_*.bg = 8
completion_pill.bg = 12
completion_default.fg = 15
completion_description.fg = 15
completion_description.dim = true
[viewer]
url.underline = true
url.fg = 3
header.bold = true
header.fg = 4
signature.dim = true
signature.fg = 4
diff_meta.bold = true
diff_chunk.fg = 6
diff_chunk_func.fg = 6
diff_chunk_func.dim = true
diff_add.fg = 2
diff_del.fg = 1
diff_whitespace.bg = 1
quote_1.fg = 6
quote_2.fg = 4
quote_3.fg = 6
quote_3.dim = true
quote_4.fg = 4
quote_4.dim = true
quote_x.fg = 5
quote_x.dim = true
code = 5
```

You can choose either to reset everything (except in the **\[viewer\]** section) by starting your styleset with these two lines:

```
*.default=true
*.normal=true
```

Or selectively override style object attributes.

If you want to also reset the **\[viewer\]** section, you need to insert the same two lines:

```
[viewer]
*.default=true
*.normal=true
```

## SEE ALSO

[**aerc**(1)](/aerc/1.md) [**aerc-config**(5)](/aerc-config/5.md)

## AUTHORS

Originally created by Drew DeVault and maintained by Robin Jarry who is assisted by other open source contributors. For more information about aerc development, see *https://sr.ht/~rjarry/aerc/*.
