| 1 |
AERC-STYLESETS(7) |
| 2 |
|
| 3 |
# NAME |
| 4 |
|
| 5 |
aerc-stylesets - styleset file specification for *aerc*(1) |
| 6 |
|
| 7 |
# SYNOPSIS |
| 8 |
|
| 9 |
aerc uses a simple configuration syntax to configure the styleset for |
| 10 |
its ui. |
| 11 |
|
| 12 |
# STYLESET CONFIGURATION |
| 13 |
|
| 14 |
The styleset is described as *<object>*.*<attribute>* = _<value>_ pairs. |
| 15 |
|
| 16 |
For example, in the line below, the foreground color of the |
| 17 |
style object *msglist_unread* is set to _cornflowerblue_ |
| 18 |
|
| 19 |
*msglist_unread*.*fg* = _cornflowerblue_ |
| 20 |
|
| 21 |
The configuration also allows wildcard matching of the keys |
| 22 |
to configure multiple style objects at a time. |
| 23 |
|
| 24 |
# ATTRIBUTES |
| 25 |
|
| 26 |
The following options are available to be modified for each of the |
| 27 |
style objects. |
| 28 |
|
| 29 |
*<object>*.*fg* = _<color>_ |
| 30 |
The foreground color of the style object is set. |
| 31 |
|
| 32 |
*<object>*.*bg* = _<color>_ |
| 33 |
The background color of the style object is set. |
| 34 |
|
| 35 |
*<object>*.*bold* = _true_|_false_|_toggle_ |
| 36 |
The bold attribute of the style object is set/unset. |
| 37 |
|
| 38 |
*<object>*.*blink* = _true_|_false_|_toggle_ |
| 39 |
The blink attribute of the style object is set/unset. |
| 40 |
The terminal needs to support blinking text. |
| 41 |
|
| 42 |
*<object>*.*underline* = _true_|_false_|_toggle_ |
| 43 |
The underline attribute of the style object is set/unset. |
| 44 |
The terminal needs to support underline text. |
| 45 |
|
| 46 |
*<object>*.*italic* = _true_|_false_|_toggle_ |
| 47 |
The italic attribute of the style object is set/unset. |
| 48 |
The terminal needs to support italic text. |
| 49 |
|
| 50 |
*<object>*.*dim* = _true_|_false_|_toggle_ |
| 51 |
The dim attribute of the style object is set/unset. |
| 52 |
The terminal needs to support half-bright text. |
| 53 |
|
| 54 |
*<object>*.*reverse* = _true_|_false_|_toggle_ |
| 55 |
Reverses the color of the style object. Exchanges the foreground |
| 56 |
and background colors. |
| 57 |
|
| 58 |
If the value is _false_, it doesn't change anything. |
| 59 |
|
| 60 |
*<object>*.*normal* = true |
| 61 |
All the attributes of the style object are unset. |
| 62 |
|
| 63 |
The value doesn't matter. |
| 64 |
|
| 65 |
*<object>*.*default* = true |
| 66 |
Set the style object to the default style of the context. Usually |
| 67 |
based on the terminal. |
| 68 |
|
| 69 |
The value doesn't matter. |
| 70 |
|
| 71 |
# STYLE OBJECTS |
| 72 |
|
| 73 |
The style objects represent the various ui elements or ui instances for |
| 74 |
styling. |
| 75 |
|
| 76 |
[[ *Style Object* |
| 77 |
:[ *Description* |
| 78 |
| *default* |
| 79 |
: The default style object used for normal ui elements while not using specialized configuration. |
| 80 |
| *error* |
| 81 |
: The style used to show errors. |
| 82 |
| *warning* |
| 83 |
: The style used when showing warnings. |
| 84 |
| *success* |
| 85 |
: The style used for success messages. |
| 86 |
| *title* |
| 87 |
: The style object used to style titles in ui elements. |
| 88 |
| *header* |
| 89 |
: The style object used to style headers in ui elements. |
| 90 |
| *realname* |
| 91 |
: The style object used to style real name(s) in the email fields in the header section of the message viewer. |
| 92 |
| *email* |
| 93 |
: The style object used to style email(s) in the email fields in the header section of the message viewer. |
| 94 |
| *subject* |
| 95 |
: The style object used to style subject in the header section of the message viewer. |
| 96 |
| *date* |
| 97 |
: The style object used to style date in the header section of the message viewer. |
| 98 |
| *statusline_default* |
| 99 |
: The default style applied to the statusline. |
| 100 |
| *statusline_error* |
| 101 |
: The style used for error messages in statusline. |
| 102 |
| *statusline_success* |
| 103 |
: The style used for success messages in statusline. |
| 104 |
| *msglist_default* |
| 105 |
: The default style for messages in a message list. |
| 106 |
| *msglist_unread* |
| 107 |
: Unread messages in a message list. |
| 108 |
| *msglist_read* |
| 109 |
: Read messages in a message list. |
| 110 |
| *msglist_flagged* |
| 111 |
: The messages with the flagged flag. |
| 112 |
| *msglist_deleted* |
| 113 |
: The messages marked as deleted. |
| 114 |
| *msglist_marked* |
| 115 |
: The messages with the marked flag. |
| 116 |
| *msglist_result* |
| 117 |
: The messages which match the current search. |
| 118 |
| *msglist_answered* |
| 119 |
: The messages marked as answered. |
| 120 |
| *msglist_forwarded* |
| 121 |
: The messages marked as forwarded. |
| 122 |
| *msglist_gutter* |
| 123 |
: The message list gutter. |
| 124 |
| *msglist_pill* |
| 125 |
: The message list scrollbar. |
| 126 |
| *msglist_thread_folded* |
| 127 |
: Visible messages that have folded thread children. |
| 128 |
| *msglist_thread_context* |
| 129 |
: The messages not matching the mailbox / query, displayed for context. |
| 130 |
| *msglist_thread_orphan* |
| 131 |
: Threaded messages that have a missing parent message. |
| 132 |
| *dirlist_default* |
| 133 |
: The default style for directories in the directory list. |
| 134 |
| *dirlist_unread* |
| 135 |
: The style used for directories with unread messages |
| 136 |
| *dirlist_recent* |
| 137 |
: The style used for directories with recent messages |
| 138 |
| *part_switcher* |
| 139 |
: Background for the part switcher in the message viewer. |
| 140 |
| *part_filename* |
| 141 |
: Attachment file name in the part switcher. |
| 142 |
| *part_mimetype* |
| 143 |
: Attachment/part MIME type in the part switcher. |
| 144 |
| *completion_default* |
| 145 |
: The default style for the completion engine. |
| 146 |
| *completion_description* |
| 147 |
: Completion item descriptions. |
| 148 |
| *completion_gutter* |
| 149 |
: The completion gutter. |
| 150 |
| *completion_pill* |
| 151 |
: The completion pill. |
| 152 |
| *tab* |
| 153 |
: The style for the tab bar. |
| 154 |
| *stack* |
| 155 |
: The style for ui stack element. |
| 156 |
| *spinner* |
| 157 |
: The style for the loading spinner. |
| 158 |
| *border* |
| 159 |
: 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_). |
| 160 |
| *selector_default* |
| 161 |
: The default style for the selector ui element. |
| 162 |
| *selector_focused* |
| 163 |
: The focused item in a selector ui element. |
| 164 |
| *selector_chooser* |
| 165 |
: The item chooser in a selector ui element. |
| 166 |
| *keyhint_default* |
| 167 |
: The default style for the keyhint popup background. |
| 168 |
| *keyhint_key* |
| 169 |
: The style for the key column in the keyhint popup. |
| 170 |
| *keyhint_desc* |
| 171 |
: The style for the description column in the keyhint popup. |
| 172 |
|
| 173 |
These next style objects only affect the built-in *colorize* filter and must be |
| 174 |
declared under a *[viewer]* section of the styleset file. |
| 175 |
|
| 176 |
[[ *Style Object* |
| 177 |
:[ *Description* |
| 178 |
| *url* |
| 179 |
: URLs. |
| 180 |
| *header* |
| 181 |
: RFC-822-like header names. |
| 182 |
| *signature* |
| 183 |
: Email signatures. |
| 184 |
| *diff_meta* |
| 185 |
: Patch diff meta lines. |
| 186 |
| *diff_chunk* |
| 187 |
: Patch diff chunks. |
| 188 |
| *diff_chunk_func* |
| 189 |
: Patch diff chunk function names. |
| 190 |
| *diff_add* |
| 191 |
: Patch diff added lines. |
| 192 |
| *diff_del* |
| 193 |
: Patch diff deleted lines. |
| 194 |
| *diff_whitespace* |
| 195 |
: Patch diff trailing whitespace. |
| 196 |
| *quote_1* |
| 197 |
: First level quoted text. |
| 198 |
| *quote_2* |
| 199 |
: Second level quoted text. |
| 200 |
| *quote_3* |
| 201 |
: Third level quoted text. |
| 202 |
| *quote_4* |
| 203 |
: Fourth level quoted text. |
| 204 |
| *quote_x* |
| 205 |
: Above fourth level quoted text. |
| 206 |
| *code* |
| 207 |
: Code blocks fenced by ``` and inline `code`. |
| 208 |
|
| 209 |
User defined styles can be used to style arbitrary strings in go-templates (see |
| 210 |
_.Style_ in *aerc-templates*(7)). User styles must be defined in the _[user]_ |
| 211 |
ini section. Styles can be referenced by their name (e.g. _red.fg_ is named |
| 212 |
"red"). |
| 213 |
|
| 214 |
Example: |
| 215 |
|
| 216 |
``` |
| 217 |
[user] |
| 218 |
red.fg=red |
| 219 |
``` |
| 220 |
|
| 221 |
User styles are layered with other styles applied to the context in which they |
| 222 |
are rendered. The user style colors (fg and/or bg) will only be effective if the |
| 223 |
context style does not define any. Other boolean attributes will be merged with |
| 224 |
the underlying style boolean attributes. |
| 225 |
|
| 226 |
For example, if the context style is: |
| 227 |
|
| 228 |
fg=red bold |
| 229 |
|
| 230 |
And the inline style is: |
| 231 |
|
| 232 |
fg=yellow italic underline |
| 233 |
|
| 234 |
The effective style will be: |
| 235 |
|
| 236 |
fg=red bold italic underline |
| 237 |
|
| 238 |
# FNMATCH STYLE WILDCARD MATCHING |
| 239 |
|
| 240 |
The styleset configuration can be made simpler by using the fnmatch |
| 241 |
style wildcard matching for the style object. |
| 242 |
|
| 243 |
The special characters used in the fnmatch wildcards are: |
| 244 |
|
| 245 |
[[ *Pattern* |
| 246 |
:[ *Meaning* |
| 247 |
| *\** |
| 248 |
: Matches everything |
| 249 |
| *\?* |
| 250 |
: Matches any single character |
| 251 |
|
| 252 |
For example, the following wildcards can be made using this syntax. |
| 253 |
|
| 254 |
[[ *Example* |
| 255 |
:[ *Description* |
| 256 |
| *\**.*fg* = _blue_ |
| 257 |
: Set the foreground color of all style objects to blue. |
| 258 |
| *\*list*.*bg* = _hotpink_ |
| 259 |
: Set the background color of all style objects that end in list to hotpink. |
| 260 |
|
| 261 |
Note that the statements in a given styleset are parsed in the order in which |
| 262 |
they are written. That means that with the following styleset: |
| 263 |
|
| 264 |
``` |
| 265 |
msglist_marked.fg = pink |
| 266 |
msglist_*.fg = white |
| 267 |
``` |
| 268 |
|
| 269 |
The *msglist_marked.fg* attribute will be set to _white_. |
| 270 |
|
| 271 |
# SELECTED MODIFIER |
| 272 |
|
| 273 |
The *selected* modifier can be applied to any style object. The style provided for |
| 274 |
the *selected* modifier is applied on top of the style object it corresponds to. |
| 275 |
|
| 276 |
If you would like to make sure messages that are flagged as read in the msglist |
| 277 |
appear in yellow foreground and black background, you can specify that with |
| 278 |
this: |
| 279 |
|
| 280 |
*msglist_default*.*selected*.*fg* = _yellow_ |
| 281 |
|
| 282 |
*msglist_default*.*selected*.*bg* = _black_ |
| 283 |
|
| 284 |
If we specify the global style selected modifier using fnmatch as below: |
| 285 |
|
| 286 |
*\**.*selected*.*reverse* = _toggle_ |
| 287 |
|
| 288 |
This toggles the reverse switch for selected version of all the style objects. |
| 289 |
|
| 290 |
*selected* objects inherit from all attributes of their non-selected |
| 291 |
counterparts. *selected* statements are parsed after non-selected ones and |
| 292 |
effectively override the attributes of the non-selected style object. |
| 293 |
|
| 294 |
# LAYERED STYLES |
| 295 |
|
| 296 |
Some styles, (currently the *msglist_\** and *dirlist_\** ones) are applied in |
| 297 |
layers. If a style differs from the base (in this case *\*list_default*) then |
| 298 |
that style applies, unless overridden by a higher layer. If *fg* and *bg* colors |
| 299 |
are not defined explicitly (or defined to the default color) they will be |
| 300 |
considered as "transparent" and the colors from the lower layer will be used |
| 301 |
instead. |
| 302 |
|
| 303 |
The order that *msglist_\** styles are applied in is, from first to last: |
| 304 |
|
| 305 |
. *msglist_default* |
| 306 |
. *msglist_unread* |
| 307 |
. *msglist_read* |
| 308 |
. *msglist_answered* |
| 309 |
. *msglist_forwarded* |
| 310 |
. *msglist_flagged* |
| 311 |
. *msglist_deleted* |
| 312 |
. *msglist_result* |
| 313 |
. *msglist_thread_folded* |
| 314 |
. *msglist_thread_context* |
| 315 |
. *msglist_thread_orphan* |
| 316 |
. *msglist_marked* |
| 317 |
|
| 318 |
So, the marked style will override all other msglist styles. |
| 319 |
|
| 320 |
The order for *dirlist_\** styles is: |
| 321 |
|
| 322 |
. *dirlist_default* |
| 323 |
. *dirlist_unread* |
| 324 |
. *dirlist_recent* |
| 325 |
|
| 326 |
# DYNAMIC MESSAGE LIST STYLES |
| 327 |
|
| 328 |
All *msglist_\** styles can be defined for specific email header values. The |
| 329 |
syntax is as follows: |
| 330 |
|
| 331 |
*msglist_<name>*._<header>_,_<header_value>_.*<attribute>* = _<attr_value>_ |
| 332 |
|
| 333 |
If _<header_value>_ starts with a tilde character _~_, it will be interpreted as |
| 334 |
a regular expression. If you are writing regular expressions that try to match |
| 335 |
with _._ or _\\._ you need to wrap like this _~/<expression>/_. |
| 336 |
|
| 337 |
_<header>,<header_value>_ can be specified multiple times to narrow down matches |
| 338 |
to more than one email header value. In that case, all given headers must match |
| 339 |
for the dynamic style to apply. |
| 340 |
|
| 341 |
Examples: |
| 342 |
|
| 343 |
``` |
| 344 |
msglist\*.X-Sourcehut-Patchset-Update,APPROVED.fg = green |
| 345 |
msglist\*.X-Sourcehut-Patchset-Update,NEEDS\_REVISION.fg = yellow |
| 346 |
msglist\*.X-Sourcehut-Patchset-Update,REJECTED.fg = red |
| 347 |
"msglist_*.Subject,~^(\\[[\w-]+\]\\s*)?\\[(RFC )?PATCH.fg" = #ffffaf |
| 348 |
"msglist_*.Subject,~^(\\[[\w-]+\]\\s*)?\\[(RFC )?PATCH.selected.fg" = #ffffaf |
| 349 |
"msglist_*.From,~^Bob.Subject,~^(\\[[\w-]+\]\\s*)?\\[(RFC )?PATCH.selected.fg" = #ffffaf |
| 350 |
"msglist_*.List-ID,~/lists\\.sr\\.ht/selected.fg" = blue |
| 351 |
``` |
| 352 |
|
| 353 |
When a dynamic style is matched to an email header, it will be used in priority |
| 354 |
compared to its non-dynamic counterpart. Provided the following styleset: |
| 355 |
|
| 356 |
``` |
| 357 |
msglist_marked.fg = blue |
| 358 |
msglist_*.Subject,~foobar.fg = red |
| 359 |
``` |
| 360 |
|
| 361 |
An email with _foobar_ in its subject will be colored in _red_ all the time, |
| 362 |
since *msglist_\** also applies to *msglist\_marked*. |
| 363 |
|
| 364 |
When multiple _<header>,<header_value>_ pairs are given, the last style which |
| 365 |
matches all given patterns will be applied. Provided the following styleset: |
| 366 |
|
| 367 |
``` |
| 368 |
msglist_*.From,~^Bob.Subject,~foobar.fg = red |
| 369 |
msglist_*.From,~^Bob.fg = blue |
| 370 |
``` |
| 371 |
|
| 372 |
An email from _Bob_ with _foobar_ in its subject will be colored in _blue_, |
| 373 |
since the second style is a full match too. |
| 374 |
|
| 375 |
# COLORS |
| 376 |
|
| 377 |
The color values are set using any of the following methods: |
| 378 |
|
| 379 |
_default_ |
| 380 |
The color is set as per the system or terminal default. |
| 381 |
|
| 382 |
_<Color name>_ |
| 383 |
Any w3c approved color name is used to set colors for the style. |
| 384 |
|
| 385 |
_<Hex code>_ |
| 386 |
Hexcode for a color can be used. The format must be _#XXXXXX_. |
| 387 |
|
| 388 |
_<Dec number>_ |
| 389 |
Color based on the terminal palette index. Valid numbers are |
| 390 |
between _0_ and _255_. |
| 391 |
|
| 392 |
# DEFAULTS |
| 393 |
|
| 394 |
Before parsing a styleset, it is first initialized with the following defaults: |
| 395 |
|
| 396 |
``` |
| 397 |
*.selected.bg = 12 |
| 398 |
*.selected.fg = 15 |
| 399 |
*.selected.bold = true |
| 400 |
statusline_*.dim = true |
| 401 |
*warning.dim = false |
| 402 |
*warning.bold = true |
| 403 |
*warning.fg = 11 |
| 404 |
*success.dim = false |
| 405 |
*success.bold = true |
| 406 |
*success.fg = 10 |
| 407 |
*error.dim = false |
| 408 |
*error.bold = true |
| 409 |
*error.fg = 9 |
| 410 |
border.bg = 12 |
| 411 |
border.fg = 15 |
| 412 |
title.bg = 12 |
| 413 |
title.fg = 15 |
| 414 |
title.bold = true |
| 415 |
header.fg = 4 |
| 416 |
header.bold = true |
| 417 |
msglist_unread.bold = true |
| 418 |
msglist_deleted.dim = true |
| 419 |
msglist_marked.bg = 6 |
| 420 |
msglist_marked.fg = 15 |
| 421 |
msglist_pill.bg = 12 |
| 422 |
msglist_pill.fg = 15 |
| 423 |
part_mimetype.fg = 12 |
| 424 |
selector_chooser.bold = true |
| 425 |
selector_focused.bold = true |
| 426 |
selector_focused.bg = 12 |
| 427 |
selector_focused.fg = 15 |
| 428 |
completion_*.bg = 8 |
| 429 |
completion_pill.bg = 12 |
| 430 |
completion_default.fg = 15 |
| 431 |
completion_description.fg = 15 |
| 432 |
completion_description.dim = true |
| 433 |
|
| 434 |
[viewer] |
| 435 |
url.underline = true |
| 436 |
url.fg = 3 |
| 437 |
header.bold = true |
| 438 |
header.fg = 4 |
| 439 |
signature.dim = true |
| 440 |
signature.fg = 4 |
| 441 |
diff_meta.bold = true |
| 442 |
diff_chunk.fg = 6 |
| 443 |
diff_chunk_func.fg = 6 |
| 444 |
diff_chunk_func.dim = true |
| 445 |
diff_add.fg = 2 |
| 446 |
diff_del.fg = 1 |
| 447 |
diff_whitespace.bg = 1 |
| 448 |
quote_1.fg = 6 |
| 449 |
quote_2.fg = 4 |
| 450 |
quote_3.fg = 6 |
| 451 |
quote_3.dim = true |
| 452 |
quote_4.fg = 4 |
| 453 |
quote_4.dim = true |
| 454 |
quote_x.fg = 5 |
| 455 |
quote_x.dim = true |
| 456 |
code = 5 |
| 457 |
``` |
| 458 |
|
| 459 |
You can choose either to reset everything (except in the *[viewer]* section) by |
| 460 |
starting your styleset with these two lines: |
| 461 |
|
| 462 |
``` |
| 463 |
*.default=true |
| 464 |
*.normal=true |
| 465 |
``` |
| 466 |
|
| 467 |
Or selectively override style object attributes. |
| 468 |
|
| 469 |
If you want to also reset the *[viewer]* section, you need to insert the same |
| 470 |
two lines: |
| 471 |
|
| 472 |
``` |
| 473 |
[viewer] |
| 474 |
*.default=true |
| 475 |
*.normal=true |
| 476 |
``` |
| 477 |
|
| 478 |
# SEE ALSO |
| 479 |
|
| 480 |
*aerc*(1) *aerc-config*(5) |
| 481 |
|
| 482 |
# AUTHORS |
| 483 |
|
| 484 |
Originally created by Drew DeVault and maintained by Robin Jarry who is assisted |
| 485 |
by other open source contributors. For more information about aerc development, |
| 486 |
see _https://sr.ht/~rjarry/aerc/_. |