5.27 Custom hl-todo colors

The ‘hl-todo’ package provides the user option hl-todo-keyword-faces: it specifies a pair of keyword and corresponding color value. The Modus themes configure that option in the interest of legibility. While this works for our purposes, users may still prefer to apply their custom values, in which case the following approach is necessary:

(defun my-modus-themes-hl-todo-faces ()
  (setq hl-todo-keyword-faces '(("TODO" . "#ff0000")
                                ("HACK" . "#ffff00")
                                ("XXX" . "#00ffff")
                                ("NOTE" . "#ff00ff"))))

(add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-hl-todo-faces)

Or include a let form, if needed:

(defun my-modus-themes-hl-todo-faces ()
  (let ((red "#ff0000")
        (blue "#0000ff"))
    (setq hl-todo-keyword-faces `(("TODO" . ,blue)
                                  ("HACK" . ,red)
                                  ("XXX" . ,red)
                                  ("NOTE" . ,blue)))))

(add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-hl-todo-faces)

Normally, we do not touch user options, though this is an exception: otherwise the defaults are not always legible.