23fda2b0ac79b9d49f46991b157f6cf819a016e5
[~bandali/refinery-theme] / refinery-theme.el
1 ;;; refinery-theme.el --- refined, minimalist, layered theme -*- lexical-binding: t; -*-
2
3 ;; Copyright (C) 2020 Amin Bandali
4
5 ;; Author: Amin Bandali <bandali@gnu.org>
6 ;; Version: 0.1.0
7 ;; Keywords: faces
8
9 ;; This program is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
13
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
21
22 ;;; Commentary:
23
24 ;; Refinery is a refined, minimalist theme inspired by the beautiful
25 ;; Commentary theme by Simon Zelazny. Like Commentary, Refinery uses
26 ;; a concept of ``layers'' of style to visually accentuate the more
27 ;; important parts text in a useful yet subtle way, while keeping the
28 ;; distractions at a minimum.
29
30 ;; 1. Comments are in red, so they easily stand out!
31 ;;
32 ;; 2. Strings have a subtle light yellow background, so as to help
33 ;; make it easier to spot their beginning and end points.
34 ;;
35 ;; 3. Function/macro definitions are in bold to help them stand out
36 ;; from ordinary text.
37
38 ;;; Code:
39
40 (deftheme refinery
41 "A minimalist high-contrast theme for GNU Emacs.
42 Includes themed faces for modes/packages like Isearch, Gnus,
43 Message, EBDB, and Ivy.")
44
45 (let* (;; supported classes of terminals
46 (class '((class color) (min-colors 16)))
47
48 ;; colors
49 (black "#000000")
50 (white "#ffffff")
51 (yellow "#ffffdf")
52 (yellow+1 "#dfdfaf")
53 (yellow+2 "#fce94f")
54 (grey "#e7e7e7")
55 (grey-1 "#666666")
56 (grey-2 "#888888")
57 (blue "#204a87")
58 (red "#a40000") ; #d70000
59 (orange "#ce5c00")
60 (green "#4e9a06")
61
62 ;; layers
63 (layer-2 `((,class (:foreground ,grey-2))))
64 (layer-1 `((,class (:foreground ,grey-1))))
65 (layer0 `((,class (:foreground ,black))))
66 (layer0-inv `((,class (:background ,black))))
67 (layer+1 `((,class (:foreground ,black :background ,yellow))))
68 (layer+2 `((,class (:foreground ,black :weight bold))))
69 (layer+3 `((,class (:foreground ,red))))
70 (layer+3b `((,class (:foreground ,red :weight bold))))
71 (layer+4 `((,class (:foreground ,red :background ,grey))))
72 (layer+4-inv `((,class (:foreground ,grey :background ,red))))
73 (layer+4b `((,class (:foreground ,red :background ,grey :weight bold))))
74 (layer+4b-inv `((,class (:foreground ,grey :background ,red :weight bold))))
75
76 ;; box
77 (box `((,class (:box (:line-width -1 :style released-button))))))
78
79 (custom-theme-set-faces
80 'refinery
81
82 `(default ,layer0)
83 `(cursor ,layer0-inv)
84
85 ;; Highlighting
86 `(linum ((,class (:background ,grey))))
87 `(fringe ((,class (:background ,white))))
88 `(highlight ((,class (:background ,yellow+2))))
89 `(hl-line ((,class (:background ,yellow+1))))
90 `(region ((,class (:background ,yellow+1))))
91 `(secondary-selection ((,class (:background ,yellow+2))))
92 `(isearch ((,class (:foreground ,white :background ,grey-1))))
93 `(lazy-highlight ((,class (:background ,grey))))
94 `(trailing-whitespace ,layer+4b-inv)
95 `(whitespace-trailing ,layer+4b-inv)
96
97 ;; Parens
98 `(show-paren-match ,layer+4b)
99 `(show-paren-mismatch ,layer+4b-inv)
100
101 ;; Comments and documentation
102 `(font-lock-comment-face ,layer+3)
103 `(font-lock-doc-face ,layer+3)
104
105 ;; Function definitions
106 `(font-lock-function-name-face ,layer+2)
107
108 ;; String literals
109 `(font-lock-string-face ,layer+1)
110
111 ;; Constants, variables, and their types
112 `(font-lock-constant-face ,layer0)
113 `(font-lock-variable-name-face ,layer0)
114 `(font-lock-type-face ,layer0)
115
116 ;; Built-ins and keywords
117 `(font-lock-builtin-face ,layer-1)
118 `(font-lock-keyword-face ,layer-2)
119
120 ;; Mode line and minibuffer prompt
121 `(mode-line ,box)
122 `(mode-line-inactive ,box)
123 `(minibuffer-prompt ,layer+2)
124
125 ;; Characters displayed as sequences using `^' or `\'
126 `(escape-glyph ,layer+3)
127
128 ;; Gnus, Message, and EBDB
129 `(gnus-group-mail-3 ,layer+2)
130 `(gnus-group-mail-3-empty ,layer-2)
131 `(gnus-summary-normal-ticked ,layer+3)
132 `(gnus-header-from ,layer+3b)
133 `(gnus-header-subject ,layer+3)
134 `(gnus-header-name ,layer-2)
135 `(gnus-header-content ,layer0)
136 `(message-header-to ,layer+3b)
137 `(message-header-cc ,layer0)
138 `(message-header-subject ,layer0)
139 `(message-header-other ,layer-2)
140 `(message-header-name ,layer-2)
141 `(message-header-xheader ((,class (:foreground ,blue))))
142 `(ebdb-person-name ,layer+3b)
143
144 ;; Ivy and family
145 `(ivy-minibuffer-match-face-1 ((,class (:background "#eeeeee"))))
146 `(ivy-minibuffer-match-face-2 ((,class (:background ,grey :weight bold))))
147 `(ivy-minibuffer-match-face-3 ((,class (:background "light goldenrod" :weight semi-bold))))
148 `(ivy-minibuffer-match-face-4 ((,class (:background "misty rose" :weight semi-bold))))
149 `(ivy-current-match ((((class color) (background light))
150 :background "#d7d7d7" :foreground ,black)
151 (((class color) (background dark))
152 :background "#65a7e2" :foreground ,black)))
153
154 ;; Error/failure, warning, and success
155 `(error ,layer+3b)
156 `(warning ((,class (:foreground ,orange))))
157 `(success ((,class (:foreground ,green)))))
158
159 (custom-theme-set-variables 'refinery))
160
161 ;;;###autoload
162 (when (and (boundp 'custom-theme-load-path) load-file-name)
163 (add-to-list 'custom-theme-load-path
164 (file-name-as-directory
165 (file-name-directory load-file-name))))
166
167 (provide-theme 'refinery)
168 ;;; refinery-theme.el ends here