aboutsummaryrefslogtreecommitdiff
path: root/filters
diff options
context:
space:
mode:
authorJens Grassel <jens@wegtam.com>2022-11-29 16:13:05 +0100
committerRobin Jarry <robin@jarry.cc>2022-11-30 16:17:10 +0100
commit118ece70af51a677f1504ec1ca13e47d0db5fc67 (patch)
treeb7bce23389411ee38e0db5965d7f1dabc2219cfc /filters
parent169a967111c70d7f413ec15be715d9c513c29878 (diff)
downloadaerc-118ece70af51a677f1504ec1ca13e47d0db5fc67.tar.gz
aerc-118ece70af51a677f1504ec1ca13e47d0db5fc67.zip
colorize: add solarized theme
This modifies the colorize script to accept a command line parameter to change the colour theme. Currently only a solarized version is added. Due to the nature of awk the theme has to be defined via the `-v` flag. Due to the `switch` statement only being available in GNU awk we use a `if else` statement to ensure that the default colours are used if either the `THEME` variable is not set at all or set to `default`. Solarized colour scheme: https://ethanschoonover.com/solarized/ Signed-off-by: Jens Grassel <jens@wegtam.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/colorize57
1 files changed, 42 insertions, 15 deletions
diff --git a/filters/colorize b/filters/colorize
index da3aac3f..ad86d504 100755
--- a/filters/colorize
+++ b/filters/colorize
@@ -1,22 +1,49 @@
#!/usr/bin/awk -f
# Copyright (c) 2022 Robin Jarry
+#
+# A filter for the aerc mail program to colorize messages / attachments.
+# Basic colour themes are supported. To use a theme set the theme variable
+# in your aerc.conf accordingly, for example:
+#
+# text/plain=colorize -v theme=solarized
BEGIN {
- # R;G;B colors
- url = "\033[38;2;255;255;175m" # yellow
- header = "\033[38;2;175;135;255m" # purple
- signature = "\033[38;2;175;135;255m" # purple
- diff_meta = "\033[1;38;2;255;255;255m" # bold white
- diff_chunk = "\033[38;2;0;205;205m" # cyan
- diff_add = "\033[38;2;0;205;0m" # green
- diff_del = "\033[38;2;205;0;0m" # red
- quote_1 = "\033[38;2;95;175;255m" # blue
- quote_2 = "\033[38;2;255;135;0m" # orange
- quote_3 = "\033[38;2;175;135;255m" # purple
- quote_4 = "\033[38;2;255;95;215m" # pink
- quote_x = "\033[38;2;128;128;128m" # gray
- bold = "\033[1m"
- reset = "\033[0m"
+ if (theme == "solarized") {
+ # R;G;B colors
+ url = "\033[38;2;181;137;0m" # yellow
+ header = "\033[38;2;211;54;130m" # magenta
+ signature = "\033[38;2;211;54;130m" # magenta
+ diff_meta = "\033[1;38;2;131;148;150m" # bold brblue
+ diff_chunk = "\033[38;2;42;161;152m" # cyan
+ diff_add = "\033[38;2;133;153;0m" # green
+ diff_del = "\033[38;2;220;50;47m" # red
+ quote_1 = "\033[38;2;38;139;210m" # blue
+ quote_2 = "\033[38;2;203;75;22m" # brred
+ quote_3 = "\033[38;2;211;54;130m" # magenta
+ quote_4 = "\033[38;2;108;113;196m" # brmagenta
+ quote_x = "\033[38;2;147;161;161m" # brcyan
+ bold = "\033[1m"
+ reset = "\033[0m"
+ } else if (theme == "" || theme == "default") {
+ # R;G;B colors
+ url = "\033[38;2;255;255;175m" # yellow
+ header = "\033[38;2;175;135;255m" # purple
+ signature = "\033[38;2;175;135;255m" # purple
+ diff_meta = "\033[1;38;2;255;255;255m" # bold white
+ diff_chunk = "\033[38;2;0;205;205m" # cyan
+ diff_add = "\033[38;2;0;205;0m" # green
+ diff_del = "\033[38;2;205;0;0m" # red
+ quote_1 = "\033[38;2;95;175;255m" # blue
+ quote_2 = "\033[38;2;255;135;0m" # orange
+ quote_3 = "\033[38;2;175;135;255m" # purple
+ quote_4 = "\033[38;2;255;95;215m" # pink
+ quote_x = "\033[38;2;128;128;128m" # gray
+ bold = "\033[1m"
+ reset = "\033[0m"
+ } else {
+ print "error: unknown theme " theme > "/dev/stderr"
+ exit 1
+ }
# state
in_diff = 0
in_signature = 0