summaryrefslogtreecommitdiffstats
path: root/refinery-theme.el
blob: 23fda2b0ac79b9d49f46991b157f6cf819a016e5 (plain) (blame)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
;;; refinery-theme.el --- refined, minimalist, layered theme  -*- lexical-binding: t; -*-

;; Copyright (C) 2020  Amin Bandali

;; Author: Amin Bandali <bandali@gnu.org>
;; Version: 0.1.0
;; Keywords: faces

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; Refinery is a refined, minimalist theme inspired by the beautiful
;; Commentary theme by Simon Zelazny.  Like Commentary, Refinery uses
;; a concept of ``layers'' of style to visually accentuate the more
;; important parts text in a useful yet subtle way, while keeping the
;; distractions at a minimum.

;; 1. Comments are in red, so they easily stand out!
;;
;; 2. Strings have a subtle light yellow background, so as to help
;; make it easier to spot their beginning and end points.
;;
;; 3. Function/macro definitions are in bold to help them stand out
;; from ordinary text.

;;; Code:

(deftheme refinery
  "A minimalist high-contrast theme for GNU Emacs.
Includes themed faces for modes/packages like Isearch, Gnus,
Message, EBDB, and Ivy.")

(let* (;; supported classes of terminals
       (class '((class color) (min-colors 16)))

       ;; colors
       (black    "#000000")
       (white    "#ffffff")
       (yellow   "#ffffdf")
       (yellow+1 "#dfdfaf")
       (yellow+2 "#fce94f")
       (grey     "#e7e7e7")
       (grey-1   "#666666")
       (grey-2   "#888888")
       (blue     "#204a87")
       (red      "#a40000")             ; #d70000
       (orange   "#ce5c00")
       (green    "#4e9a06")

       ;; layers
       (layer-2      `((,class (:foreground ,grey-2))))
       (layer-1      `((,class (:foreground ,grey-1))))
       (layer0       `((,class (:foreground ,black))))
       (layer0-inv   `((,class (:background ,black))))
       (layer+1      `((,class (:foreground ,black :background ,yellow))))
       (layer+2      `((,class (:foreground ,black :weight bold))))
       (layer+3      `((,class (:foreground ,red))))
       (layer+3b     `((,class (:foreground ,red :weight bold))))
       (layer+4      `((,class (:foreground ,red :background ,grey))))
       (layer+4-inv  `((,class (:foreground ,grey :background ,red))))
       (layer+4b     `((,class (:foreground ,red :background ,grey :weight bold))))
       (layer+4b-inv `((,class (:foreground ,grey :background ,red :weight bold))))

       ;; box
       (box `((,class (:box (:line-width -1 :style released-button))))))

  (custom-theme-set-faces
   'refinery

   `(default ,layer0)
   `(cursor  ,layer0-inv)

   ;; Highlighting
   `(linum               ((,class (:background ,grey))))
   `(fringe              ((,class (:background ,white))))
   `(highlight           ((,class (:background ,yellow+2))))
   `(hl-line             ((,class (:background ,yellow+1))))
   `(region              ((,class (:background ,yellow+1))))
   `(secondary-selection ((,class (:background ,yellow+2))))
   `(isearch             ((,class (:foreground ,white :background ,grey-1))))
   `(lazy-highlight      ((,class (:background ,grey))))
   `(trailing-whitespace ,layer+4b-inv)
   `(whitespace-trailing ,layer+4b-inv)

   ;; Parens
   `(show-paren-match    ,layer+4b)
   `(show-paren-mismatch ,layer+4b-inv)

   ;; Comments and documentation
   `(font-lock-comment-face ,layer+3)
   `(font-lock-doc-face     ,layer+3)

   ;; Function definitions
   `(font-lock-function-name-face ,layer+2)

   ;; String literals
   `(font-lock-string-face ,layer+1)

   ;; Constants, variables, and their types
   `(font-lock-constant-face      ,layer0)
   `(font-lock-variable-name-face ,layer0)
   `(font-lock-type-face          ,layer0)

   ;; Built-ins and keywords
   `(font-lock-builtin-face       ,layer-1)
   `(font-lock-keyword-face       ,layer-2)

   ;; Mode line and minibuffer prompt
   `(mode-line          ,box)
   `(mode-line-inactive ,box)
   `(minibuffer-prompt  ,layer+2)

   ;; Characters displayed as sequences using `^' or `\'
   `(escape-glyph ,layer+3)

   ;; Gnus, Message, and EBDB
   `(gnus-group-mail-3          ,layer+2)
   `(gnus-group-mail-3-empty    ,layer-2)
   `(gnus-summary-normal-ticked ,layer+3)
   `(gnus-header-from           ,layer+3b)
   `(gnus-header-subject        ,layer+3)
   `(gnus-header-name           ,layer-2)
   `(gnus-header-content        ,layer0)
   `(message-header-to          ,layer+3b)
   `(message-header-cc          ,layer0)
   `(message-header-subject     ,layer0)
   `(message-header-other       ,layer-2)
   `(message-header-name        ,layer-2)
   `(message-header-xheader     ((,class (:foreground ,blue))))
   `(ebdb-person-name           ,layer+3b)

   ;; Ivy and family
   `(ivy-minibuffer-match-face-1 ((,class (:background "#eeeeee"))))
   `(ivy-minibuffer-match-face-2 ((,class (:background ,grey :weight bold))))
   `(ivy-minibuffer-match-face-3 ((,class (:background "light goldenrod" :weight semi-bold))))
   `(ivy-minibuffer-match-face-4 ((,class (:background "misty rose" :weight semi-bold))))
   `(ivy-current-match           ((((class color) (background light))
                                   :background "#d7d7d7" :foreground ,black)
                                  (((class color) (background dark))
                                   :background "#65a7e2" :foreground ,black)))

   ;; Error/failure, warning, and success
   `(error   ,layer+3b)
   `(warning ((,class (:foreground ,orange))))
   `(success ((,class (:foreground ,green)))))

  (custom-theme-set-variables 'refinery))

;;;###autoload
(when (and (boundp 'custom-theme-load-path) load-file-name)
  (add-to-list 'custom-theme-load-path
               (file-name-as-directory
                (file-name-directory load-file-name))))

(provide-theme 'refinery)
;;; refinery-theme.el ends here