aboutsummaryrefslogtreecommitdiff
path: root/modules/org-faces-config.el
blob: dfbfe9d0dee02b64c0856bed3166f43d3a5b02e7 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
;;; org-faces-config.el --- Custom faces for the org agenda header row -*- lexical-binding: t; coding: utf-8; -*-
;; author Craig Jennings <c@cjennings.net>

;;; Commentary:
;;
;; Layer: 2 (Core UX).
;; Category: C/S.
;; Load shape: eager.
;; Eager reason: the faces must exist before org renders the agenda.
;; Top-level side effects: defines the org-faces-* faces; sets
;;   org-todo-keyword-faces and org-priority-faces once org loads.
;; Runtime requires: none (org wiring is deferred via with-eval-after-load).
;;
;; Custom faces for the agenda "header row" -- the TODO keyword and the
;; priority cookie -- so each keyword and each priority is its own themeable
;; element rather than sharing org's built-in org-todo / org-done / org-priority.
;; They are named org-faces-* (not org-*) so it's obvious they are this config's
;; layer, not built-in org.  Each carries a real default color so the agenda is
;; legible on any theme; a theme (e.g. one generated by theme-studio's
;; "org-faces" app) overrides them.  The -dim variants are the dimmed colors
;; auto-dim-config.el remaps these to in non-selected windows, so keywords stay
;; recognizable when a window recedes.
;;
;; Note: this file is org-faces-CONFIG, not org-faces -- org ships its own
;; `org-faces' feature (lisp/org/org-faces.el), so reusing that name would
;; shadow org's face definitions on the load path.

;;; Code:

(eval-when-compile (require 'org))

(defgroup org-faces-config nil
  "Custom faces for the org agenda header row (keywords and priorities)."
  :group 'org)

;; --------------------------- Keyword faces (focused) -------------------------

(defface org-faces-todo      '((t (:weight bold)))
  "Face for the TODO keyword." :group 'org-faces-config)
(defface org-faces-project   '((t (:weight bold)))
  "Face for the PROJECT keyword." :group 'org-faces-config)
(defface org-faces-doing     '((t (:weight bold)))
  "Face for the DOING keyword." :group 'org-faces-config)
(defface org-faces-waiting   '((t (:weight bold)))
  "Face for the WAITING keyword." :group 'org-faces-config)
(defface org-faces-verify    '((t (:weight bold)))
  "Face for the VERIFY keyword." :group 'org-faces-config)
(defface org-faces-stalled   '((t (:weight bold)))
  "Face for the STALLED keyword." :group 'org-faces-config)
(defface org-faces-delegated '((t (:weight bold)))
  "Face for the DELEGATED keyword." :group 'org-faces-config)
(defface org-faces-failed    '((t (:weight bold)))
  "Face for the FAILED keyword." :group 'org-faces-config)
(defface org-faces-done      '((t (:weight bold)))
  "Face for the DONE keyword." :group 'org-faces-config)
(defface org-faces-cancelled '((t (:weight bold :strike-through t)))
  "Face for the CANCELLED keyword." :group 'org-faces-config)

;; -------------------------- Priority faces (focused) -------------------------

(defface org-faces-priority-a '((t (:weight bold)))
  "Face for the [#A] priority cookie." :group 'org-faces-config)
(defface org-faces-priority-b '((t ()))
  "Face for the [#B] priority cookie." :group 'org-faces-config)
(defface org-faces-priority-c '((t ()))
  "Face for the [#C] priority cookie." :group 'org-faces-config)
(defface org-faces-priority-d '((t ()))
  "Face for the [#D] priority cookie." :group 'org-faces-config)

;; ----------------------------- Keyword faces (dim) ---------------------------
;; auto-dim-config.el remaps the focused faces above to these in non-selected
;; windows; a darker shade of the same hue keeps the keyword recognizable.

(defface org-faces-todo-dim      '((t (:weight bold)))
  "Dimmed TODO keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-project-dim   '((t (:weight bold)))
  "Dimmed PROJECT keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-doing-dim     '((t (:weight bold)))
  "Dimmed DOING keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-waiting-dim   '((t (:weight bold)))
  "Dimmed WAITING keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-verify-dim    '((t (:weight bold)))
  "Dimmed VERIFY keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-stalled-dim   '((t (:weight bold)))
  "Dimmed STALLED keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-delegated-dim '((t (:weight bold)))
  "Dimmed DELEGATED keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-failed-dim    '((t (:weight bold)))
  "Dimmed FAILED keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-done-dim      '((t (:weight bold)))
  "Dimmed DONE keyword for non-selected windows." :group 'org-faces-config)
(defface org-faces-cancelled-dim '((t (:weight bold :strike-through t)))
  "Dimmed CANCELLED keyword for non-selected windows." :group 'org-faces-config)

;; ---------------------------- Priority faces (dim) ---------------------------

(defface org-faces-priority-a-dim '((t (:weight bold)))
  "Dimmed [#A] priority cookie for non-selected windows." :group 'org-faces-config)
(defface org-faces-priority-b-dim '((t ()))
  "Dimmed [#B] priority cookie for non-selected windows." :group 'org-faces-config)
(defface org-faces-priority-c-dim '((t ()))
  "Dimmed [#C] priority cookie for non-selected windows." :group 'org-faces-config)
(defface org-faces-priority-d-dim '((t ()))
  "Dimmed [#D] priority cookie for non-selected windows." :group 'org-faces-config)

;; ---------------------------------- Wiring -----------------------------------
;; Map each keyword string and priority char to its face once org is loaded, so
;; the values stick regardless of when org initializes.

(with-eval-after-load 'org
  (setq org-todo-keyword-faces
        '(("TODO"      . org-faces-todo)
          ("PROJECT"   . org-faces-project)
          ("DOING"     . org-faces-doing)
          ("WAITING"   . org-faces-waiting)
          ("VERIFY"    . org-faces-verify)
          ("STALLED"   . org-faces-stalled)
          ("DELEGATED" . org-faces-delegated)
          ("FAILED"    . org-faces-failed)
          ("DONE"      . org-faces-done)
          ("CANCELLED" . org-faces-cancelled)))
  (setq org-priority-faces
        '((?A . org-faces-priority-a)
          (?B . org-faces-priority-b)
          (?C . org-faces-priority-c)
          (?D . org-faces-priority-d))))

(provide 'org-faces-config)
;;; org-faces-config.el ends here