REF clean up tags coloring code

This commit is contained in:
Nathan Dwarshuis 2021-04-17 16:08:28 -04:00
parent d51313232b
commit f5adbf86fa
1 changed files with 14 additions and 14 deletions

View File

@ -2197,20 +2197,20 @@ I use tags for agenda filtering (primarily for GTD contexts, see below). Each ta
:END: :END:
Each group also has its own color, defined by its prefix symbol. Each group also has its own color, defined by its prefix symbol.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun nd/add-tag-face (fg-name prefix) (let ((grouped-tags (->> (--filter (stringp (car it)) org-tag-alist)
"Adds list of cons cells to org-tag-faces with foreground set to fg-name. (-map #'car)
Start and end specify the positions in org-tag-alist which define the tags (--group-by (elt it 0)))))
to which the faces are applied" (cl-flet
(dolist (tag (org-x-filter-list-prefix prefix (mapcar #'car org-tag-alist))) ((add-foreground
(push `(,tag . (:foreground ,fg-name)) org-tag-faces))) (prefix color)
(->> (alist-get prefix grouped-tags)
(setq org-tag-faces '()) (--map (list it :foreground color)))))
(setq org-tag-faces
(nd/add-tag-face "PaleGreen" "@") (append
(nd/add-tag-face "SkyBlue" "#") (add-foreground org-x-tag-location-context-prefix "PaleGreen")
(nd/add-tag-face "PaleGoldenrod" "%") (add-foreground org-x-tag-resource-context-prefix "SkyBlue")
(nd/add-tag-face "violet" "_") (add-foreground org-x-tag-misc-prefix "PaleGoldenrod")
(nd/add-tag-face "OrangeRed1" "τ") (add-foreground org-x-tag-category-prefix "violet")))))
#+END_SRC #+END_SRC
*** properties *** properties
:PROPERTIES: :PROPERTIES: