code / dots / emacs/case-theme.el

1;;; case-theme -*- lexical-binding: t; -*-
2;; a little theme (framework)
3;; named after me, Case Duckworth <acdw@acdw.net>
4
5(deftheme case
6  "a little theme (framework)"
7  :background-mode 'light)
8
9;;; Customization
10
11(defgroup case-theme nil
12  "a little theme (framework) customization")
13
14(defun case-update (sym val)
15  "Update the theme `case' with new values.
16Stolen from `modus-themes--set-option', which see."
17  (set-default sym val)
18  (unless (null (bound-and-true-p custom--inhibit-theme-enable))
19    (load-theme 'case t)))
20
21(defcustom case-foreground "black"
22  "Default face text color"
23  :type 'string
24  :set #'case-update
25  :initialize #'custom-initialize-default)
26
27(defcustom case-background "white"
28  "Default face background color"
29  :type 'string
30  :set #'case-update
31  :initialize #'custom-initialize-default)
32
33(defcustom case-highlight-1 "yellow"
34  "Main highlight background color"
35  :type 'string
36  :set #'case-update
37  :initialize #'custom-initialize-default)
38
39(defcustom case-highlight-2 "gray"
40  "Secondary highlight background color"
41  :type 'string
42  :set #'case-update
43  :initialize #'custom-initialize-default)
44
45(defcustom case-link "navy"
46  "Link foreground color"
47  :type 'string
48  :set #'case-update
49  :initialize #'custom-initialize-default)
50
51(defcustom case-success "green"
52  "Success foreground color"
53  :type 'string
54  :set #'case-update
55  :initialize #'custom-initialize-default)
56
57(defcustom case-error "red"
58  "Error background color"
59  :type 'string
60  :set #'case-update
61  :initialize #'custom-initialize-default)
62
63(defcustom case-warning "dark orange"
64  "Warning background color"
65  :type 'string
66  :set #'case-update
67  :initialize #'custom-initialize-default)
68
69(defcustom case-shadow "gray"
70  "Foreground color for less-important information"
71  :type 'string
72  :set #'case-update
73  :initialize #'custom-initialize-default)
74
75(defcustom case-string "gray95"
76  "Background color for strings"
77  :type 'string
78  :set #'case-update
79  :initialize #'custom-initialize-default)
80
81(defcustom case-region "gray85"
82  "Bacground color for the region"
83  :type 'string
84  :set #'case-update
85  :initialize #'custom-initialize-default)
86
87(defcustom case-mode-line-active "cyan"
88  "Active modeline background"
89  :type 'string
90  :set #'case-update
91  :initialize #'custom-initialize-default)
92
93(defcustom case-mode-line-inactive "gray"
94  "Inactive modeline background"
95  :type 'string
96  :set #'case-update
97  :initialize #'custom-initialize-default)
98
99(defface case-prompt '((t (:weight bold)))
100  "Face for prompts")
101
102;;; Set the colors
103
104;; (custom-theme-set-variables 'case)
105
106(defun fclear (face)
107  "Return a `custom-theme-set-faces' spec clearing FACE of all properties."
108  ;; TODO: Allow interactive use that will call .. that function that sets the
109  ;; face on the fly
110  (list face '((t ()))))
111
112(custom-theme-set-faces
113 'case
114 ;; Default
115 `(default ((t ( :foreground ,case-foreground
116                 :background ,case-background))))
117
118 ;; Font lock -- clear
119 (fclear 'font-lock-bracket-face)
120 (fclear 'font-lock-builtin-face)
121 (fclear 'font-lock-constant-face)
122 (fclear 'font-lock-delimiter-face)
123 (fclear 'font-lock-doc-markup-face)
124 (fclear 'font-lock-escape-face)
125 (fclear 'font-lock-function-call-face)
126 (fclear 'font-lock-function-name-face)
127 (fclear 'font-lock-keyword-face)
128 (fclear 'font-lock-misc-punctuation-face)
129 (fclear 'font-lock-negation-char-face)
130 (fclear 'font-lock-number-face)
131 (fclear 'font-lock-operator-face)
132 (fclear 'font-lock-preprocessor-face)
133 (fclear 'font-lock-property-name-face)
134 (fclear 'font-lock-property-use-face)
135 (fclear 'font-lock-punctuation-face)
136 (fclear 'font-lock-regexp-face)
137 (fclear 'font-lock-regexp-grouping-backslash)
138 (fclear 'font-lock-regexp-grouping-construct)
139 (fclear 'font-lock-type-face)
140 (fclear 'font-lock-variable-name-face)
141 (fclear 'font-lock-variable-use-face)
142 (fclear 'font-lock-warning-face)
143
144 ;; Font lock
145 `(font-lock-comment-delimiter-face ((t (:slant italic))))
146 `(font-lock-comment-face ((t (:slant italic))))
147 `(font-lock-string-face ((t ( :underline nil :bold nil
148                               :background ,case-string))))
149 `(font-lock-doc-face ((t (:inherit (font-lock-string-face
150                                     font-lock-comment-face)))))
151
152 ;; Propertized text
153 `(bold ((t (:weight bold))))
154 `(error ((t (:foreground ,case-error :slant italic))))
155 `(highlight ((t (:background ,case-highlight-2))))
156 `(isearch ((t (:background ,case-highlight-1))))
157 `(isearch-fail ((t (:background ,case-error))))
158 `(italic ((t (:slant italic))))
159 `(lazy-highlight ((t (:background ,case-highlight-2))))
160 `(link ((t (:foreground ,case-link :underline t))))
161 `(match ((t (:background ,case-highlight-2))))
162 `(pulse-highlight-start-face ((t (:background ,case-highlight-1))))
163 `(query-replace ((t (:background ,case-highlight-2))))
164 `(region ((t (:background ,case-region))))
165 `(shadow ((t (:foreground ,case-shadow))))
166 `(show-paren-match ((t (:background ,case-highlight-2))))
167 `(show-paren-mismatch ((t (:foreground ,case-error :slant italic))))
168 `(success ((t (:foreground ,case-success :slant italic))))
169 `(trailing-whitespace ((t (:background ,case-error))))
170 `(underline ((t (:underline t))))
171 `(warning ((t (:foreground ,case-warning :slant italic))))
172
173 ;; User interface
174 `(completions-annotations ((t (:inherit 'italic))))
175 `(completions-highlight ((t (:background ,case-highlight-1))))
176 `(header-line ((t (:inherit (mode-line-inactive)))))
177 `(minibuffer-prompt ((t (:inherit case-prompt))))
178 `(mode-line ((t (:background ,case-shadow :inherit variable-pitch))))
179 `(mode-line-active ((t ( :box ,case-foreground :background ,case-mode-line-active
180                          :inherit mode-line))))
181 `(mode-line-inactive ((t ( :box ,case-mode-line-inactive
182                            :background ,case-mode-line-inactive
183                            :inherit mode-line))))
184 `(tab-bar ((t (:inherit mode-line-inactive))))
185 `(tab-bar-tab ((t ( :weight bold :underline t
186                     :inherit variable-pitch))))
187 `(tab-bar-tab-inactive ((t ( :background ,case-mode-line-inactive
188                              :inherit variable-pitch))))
189 `(vertical-border ((t (:foreground ,case-shadow))))
190
191 ;;; Specific modes &c
192 ;; Outline --- these go first b/c so many other headlines inherit from them
193 `(outline-1 ((t (:inherit (bold underline italic) :extend t))))
194 `(outline-2 ((t (:inherit (bold underline)))))
195 `(outline-3 ((t (:inherit (italic underline)))))
196 `(outline-3 ((t (:inherit (italic underline)))))
197 `(outline-4 ((t (:inherit (italic underline)))))
198 `(outline-5 ((t (:inherit (italic underline)))))
199 `(outline-6 ((t (:inherit (italic underline)))))
200 `(outline-7 ((t (:inherit (italic underline)))))
201 `(outline-8 ((t (:inherit (italic underline)))))
202 ;; Avy
203 `(avy-lead-face ((t (:inherit isearch :box t))))
204 `(avy-lead-face-0 ((t (:inherit avy-lead-face))))
205 `(avy-lead-face-1 ((t (:inherit avy-lead-face))))
206 `(avy-lead-face-2 ((t (:inherit avy-lead-face))))
207 ;; Dired
208 `(dired-header ((t (:underline t :extend t))))
209 ;; Dired-Subtree
210 (fclear 'dired-subtree-depth-1-face)
211 (fclear 'dired-subtree-depth-2-face)
212 (fclear 'dired-subtree-depth-3-face)
213 (fclear 'dired-subtree-depth-4-face)
214 (fclear 'dired-subtree-depth-5-face)
215 (fclear 'dired-subtree-depth-6-face)
216 ;; Elastic indent
217 `(elastic-indent ((t ())))
218 ;; Eshell
219 `(eshell-prompt ((t (:inherit case-prompt))))
220 ;; Eww
221 `(eww-form-text ((t (:inherit alice-input-field))))
222 ;; Gemtext mode
223 `(gemtext-face-heading1 ((t (:inherit outline-1))))
224 `(gemtext-face-heading2 ((t (:inherit outline-2))))
225 `(gemtext-face-heading3 ((t (:inherit outline-3))))
226 `(gemtext-face-markup ((t (:inherit font-lock-comment-face))))
227 `(gemtext-face-pre-text ((t (:extend t :inherit font-lock-string-face))))
228 ;; Info
229 `(info-title-1 ((t (:inherit outline-1))))
230 `(info-title-2 ((t (:inherit outline-2))))
231 `(info-title-3 ((t (:inherit outline-3))))
232 `(info-title-4 ((t (:inherit outline-4))))
233 ;; Jabber
234 `(jabber-activity-face ((t (:inherit italic))))
235 `(jabber-activity-personal-face ((t (:inherit rcirc-track-nick))))
236 `(jabber-chat-error ((t (:inherit error))))
237 `(jabber-chat-prompt-foreign ((t (:inherit case-prompt))))
238 `(jabber-chat-prompt-local ((t (:inherit case-prompt))))
239 `(jabber-chat-prompt-system ((t (:inherit case-prompt))))
240 `(jabber-chat-text-foreign ((t (:inherit default))))
241 `(jabber-chat-text-local ((t (:inherit default))))
242 `(jabber-muc-presence-dim ((t (:inherit shadow))))
243 `(jabber-rare-time-face ((t (:inherit shadow))))
244 `(jabber-title-large ((t (:inherit outline-1))))
245 `(jabber-title-medium ((t (:inherit outline-2))))
246 `(jabber-title-small ((t (:inherit outline-3))))
247 (fclear 'markdown-markup-face)
248 ;; Org
249 `(org-document-info-keyword ((t (:inherit (bold)))))
250 `(org-document-info ((t (:inherit (italic)))))
251 `(org-document-title ((t (:inherit (bold italic underline)))))
252 `(org-drawer ((t (:inherit (font-lock-comment-face)))))
253 `(org-verbatim ((t (:background ,case-string))))
254 ;; RCIRC
255 `(rcirc-my-nick ((t (:weight bold :slant italic))))
256 `(rcirc-nick-in-message ((t (:weight bold :slant italic))))
257 `(rcirc-other-nick ((t (:slant italic))))
258 `(rcirc-prompt ((t (:inherit case-prompt))))
259 `(rcirc-timestamp ((t (:inherit shadow))))
260 `(rcirc-server ((t (:inherit shadow))))
261 `(rcirc-track-nick ((t (:weight bold :slant italic :inverse-video nil))))
262 ;; Sh
263 `(sh-heredoc ((t ( :inherit font-lock-string-face :extend t ))))
264 (fclear 'sh-quoted-exec)
265 ;; Widgets
266 `(widget-field ((t (:inherit alice-input-field))))
267 `(widget-single-line-field ((t (:inherit alice-input-field))))
268 ;; Whitespace-mode
269 `(whitespace-tab ((t (:foreground ,case-shadow))))
270 )