aboutsummaryrefslogtreecommitdiffstats
path: root/config/style.go
Commit message (Collapse)AuthorAgeFilesLines
* style: add msglist_gutter and msglist_pill to configKonstantin Shelekhin2023-08-111-0/+4
| | | | | | | | | | Allow a user to change the default style of the message list scrollbar. There is no easy way to set the default style for an object directly in code, so I've updated every built-in theme to preserve the existing style. Signed-off-by: Konstantin Shelekhin <k.shelekhin@ftml.net> Acked-by: Robin Jarry <robin@jarry.cc>
* styles: add style for folded threadsKoni Marti2023-07-161-0/+3
| | | | | | | | | Add a style for folded threads. Use msglist_thread_folded in the stylesheet like "msglist_thread_folded.dim = true" Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: inwit <inwit@sindominio.net>
* config: fix multiple dynamic stylesTim Culverhouse2023-06-011-3/+4
| | | | | | | | | | | | | | | When a user sets multiple dynamic styles, only the first one is applied. The parsing function is modifying the matching pattern prior to saving it to the style. When a second occurrence of the same dynamic style is seen, the patterns don't match because we compare against the raw user input instead of the modified pattern value. Store the raw user input as the pattern instead of our modified regex. Fixes: 2f46f64b0b0b ("styleset: allow dynamic msglist styling") Reported-by: Drew Devault <sir@cmpwn.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Drew Devault <sir@cmpwn.com> Acked-by: Robin Jarry <robin@jarry.cc>
* stylesets: fix *.selected parsingRobin Jarry2023-04-021-1/+1
| | | | | | | | | | | | | | | | | | | The stylesets are parsed in two passes. The first pass skips the .selected keys and updates the attributes and colors of both the objects and selected maps. The second pass is supposed to only update the selected map of the pointed style objects. The boolean logic was incorrect, the .selected styles were applied on normal objects as well which led to confusing behaviour most specifically when using *.selected.toggle=true. Properly parse .selected elements. Fixes: 47675e80850d ("config: rework styleset parsing") Reported-by: John Mcenroy <handplanet@outlook.com> Reported-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Kirill Chibisov <contact@kchibisov.com>
* styleset: allow dynamic msglist stylingRobin Jarry2023-03-311-25/+87
| | | | | | | | | | | Add support for dynamic msglist*.$HEADER,$VALUE.$ATTR = $VALUE where $VALUE can be either a fixed string or a regular expression. This is intended as a replacement of contextual ui sections based on subject values. Implements: https://todo.sr.ht/~rjarry/aerc/18 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* config: rework styleset parsingRobin Jarry2023-03-311-115/+53
| | | | | | | Simplify code. Prepare for dynamic styling of the message list. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* style: inherit colors unless explicitly set in layered stylesRobin Jarry2023-03-311-2/+2
| | | | | | | | Inherit from the lower layers colors unless explicitly overridden in upper layers. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* templates: avoid error when using .Style with unknown style nameRobin Jarry2023-03-081-1/+4
| | | | | | | | | | | | | | | | | When using {{.Style "foo" bar}} and "foo" is not defined in the styleset under the [user] section, there is an obscure error: template: column-right:1:18: executing "column-right" at <.Style>: error calling Style: runtime error: invalid memory address or nil pointer dereference Which is most of the time truncated and can only be read in logs. Referencing an undefined style is not a serious problem. Return the default tcell style in that case and avoid the error. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* templates: allow inline user stylesTim Culverhouse2023-03-021-0/+32
| | | | | | | | | | | | | | | | | | | | Allow custom user-defined styles in a styleset. The styles can take any name, and must be under the [user] ini section. All attributes apply to user defined styles. Example: [user] red.fg=red red.bold=true Add a .Style function which accepts the name of a user-defined style and applies it to the string. {{.Style "red" "foo"}} Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* filters: rewrite colorize in cRobin Jarry2023-01-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since its introduction, we had multiple issues with the colorize awk script with regard to non-GNU awk compatibility. Also, this script is standalone and the color theme must be hard coded into it. Reading from an external configuration file (aerc's styleset) from a non-GNU awk is close to impossible (and even far from trivial with GNU awk). Rewrite the builtin colorize filter in C to allow getting the color theme from aerc's active styleset. The theme is configured using the existing styleset syntax and attributes under a separate [viewer] section (see examples and man page). Export the active styleset file path to AERC_STYLESET env var when invoking the filter command so that colorize can access it and use it. I have tested compilation (with clang-analyzer and gcc -fanalyzer) and basic operation on FreeBSD, Fedora (glibc) and Alpine (muslibc). More tests would probably be required on MacOSX and older Linux distros. I also added test vectors to give some confidence that this works as expected. The execution with these vectors passed valgrind --leak-check=full without errors. NB: the default theme has changed to be more minimal. Sample stylesets have more colorful examples. The awk -v theme=xxx option is no longer supported. usage: colorize [-h] [-s FILE] [-f FILE] options: -h show this help message -s FILE use styleset file (default $AERC_STYLESET) -f FILE read from filename (default stdin) Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* stylesets: add support for dim textRobin Jarry2023-01-261-1/+13
| | | | | | | Allow defining <obj>.dim=true to turn on half-bright text. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* style: add msglist_answered config optionMartin Lucina2023-01-101-7/+9
| | | | | | | | Add a style for messages that have been marked as answered, and a "msglist_answered" config option for it. Signed-off-by: Martin Lucina <martin@lucina.net> Acked-by: Robin Jarry <robin@jarry.cc>
* style: add italic optionTim Culverhouse2022-11-091-1/+13
| | | | | | | | Add italic option to style config. Update docs. Suggested-by: inwit <inwit@sindominio.net> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* msglist: style search resultsTim Culverhouse2022-11-061-0/+2
| | | | | | | | Add option to style search results in the message list. Set default style for results. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* status: add warning style and methodsTim Culverhouse2022-11-061-0/+2
| | | | | | | | Add a warning style to default statusline. Add methods to status, aerc, and account to push a warning message. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: apply new formatting rulesMoritz Poldrack2022-08-011-1/+2
| | | | | | | Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* style: add style config options for dirlist_unread and dirlist_recentTim Culverhouse2022-04-271-0/+4
| | | | | | | | Adds two style options: dirlist_unread and dirlist_recent. These options apply in layers, in the same way as msglist_* styles do. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* stylesets: allow specifying color by numberTobias Wölfel2022-04-071-2/+14
| | | | | | | | | Make it possible to specify the color in the style sets by number in addition to the color name. This allows using colors defined by the terminal. Signed-off-by: Tobias Wölfel <tobias.woelfel@mailbox.org> Acked-by: Robin Jarry <robin@jarry.cc>
* update tcell to v2 and enable TrueColor supporty0ast2020-12-181-1/+1
| | | | | | | | | Also update to the tcell v2 PaletteColor api, which should keep the chosen theme of the user intact. Note, that if $TRUECOLOR is defined and a truecolor given, aerc will now stop clipping the value to one of the theme colors. Generally this is desired behaviour though.
* Apply relevant msglist styles in orderChris Vittal2020-11-011-2/+48
| | | | | | | | | | | | | | | | | | Allow styles to be layered over a base style. The list of styles to apply is layered over the base style in order, such that if the layer does not differ from the base it is not used. The order that these styles are applied in is, from first to last: msglist_default msglist_unread msglist_read (exclusive with unread, so technically the same level) msglist_flagged msglist_deleted msglist_marked So, msglist_marked style dominates. This fixes an issue where the msglist_deleted style was not being applied.
* correct tcell.Style for underlinesqwishy2020-08-291-1/+1
|
* stylesets: only accept comment char after whitespaceThorben Günther2020-08-071-1/+4
| | | | | | Without the option SpaceBeforeInlineComment set, go-ini will parse just a single " This lead to people being unable to specify hex color codes
* Implement style configuration.Kalyan Sriram2020-08-061-0/+379
| | | | | | Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
* Revert "Implement style configuration."Reto Brunner2020-07-301-379/+0
| | | | This reverts commit 1ff687ca2b0821c2cacc1fa725abb3302d2af9da.
* Implement style configuration.Kalyan Sriram2020-07-301-0/+379
| | | | | | Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
* Revert "Add Style configuration"Drew DeVault2020-05-281-372/+0
| | | | This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
* Add Style configurationReto Brunner2020-05-271-0/+372
The following functionalities are added to configure aerc ui styles. - Read stylesets from file with very basic fnmatch wildcard matching - Add default styleset - Support different stylesets as part of UiConfig allowing contextual styles. - Move widgets/ui elements to use the stylesets. - Add configuration manual for the styleset