summaryrefslogtreecommitdiffstats
path: root/shr-dont-colorize.post
blob: d17caec7acd09a3ea2371ac0a73d769dcf84791c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;;;;;
title: Stop shr from using background color
tags: emacs, elisp, config, gnus, html
date: 2014-04-03 22:11
format: md
;;;;;

Here's just one more example why Emacs is so awesome

Reading mail in Gnus is very nice, but shr has become a little too
good at its job. Add to this the many occasions when a background is
specified without specifying a foreground, plus a color theme that
is the inverse of what is usually expected, and you can get
hard-to-read HTML messages, gray foreground and gray background.

I've looked at the other possible renderers, but they don't look
very nice compared to shr. So just remove its ability to add
background colors.

```emacs-lisp
(defun oni:shr-colorize-remove-last-arg (args)
  "If ARGS has more than 3 items, remove the last one."
  (if (> (length args) 3)
      (butlast args)
    args))

(with-eval-after-load 'shr
  (advice-add #'shr-colorize-region :filter-args
              #'oni:shr-colorize-remove-last-arg))
```

<!-- Local Variables: -->
<!-- mode: markdown -->
<!-- End: -->