This repository has been archived by the owner on Mar 22, 2020. It is now read-only.
forked from belak/emacs-monokai-pro-theme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
monokai-pro-theme.el
502 lines (430 loc) · 18.8 KB
/
monokai-pro-theme.el
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
;;; monokai-pro-theme.el --- A simple theme based on the Monokai Pro Sublime color schemes
;; Copyright (C) 2019 Kaleb Elwert
;; Author: Kaleb Elwert <[email protected]>
;; Maintainer: Kaleb Elwert <[email protected]>
;; Version: 0.1
;; Package-Version: 20190924.2152
;; URL: https://github.com/belak/emacs-monokai-pro-theme
;;; Commentary:
;; This theme is a simple theme based on the monokai-pro colors.
;;; Code:
(defvar monokai-pro-theme-colors
'(;; Background and foreground colors
:bg "#2d2a2e"
:bg+1 "#353236"
:bg+2 "#403e41"
:fg-4 "#5b595c"
:fg-3 "#727072"
:fg-2 "#939293"
:fg-1 "#c1c0c0"
:fg "#fcfcfa"
;; General colors
:white "#ffffff"
:red "#ff6188"
:orange "#fc9867"
:yellow "#ffd866"
:green "#a9dc76"
:blue "#78dce8"
:purple "#ab9df2"
:pink "#ff6188"))
(defvar monokai-pro-ristretto-theme-colors
'(;; Background and foreground colors
:bg "#2C2525"
:bg+1 "#403838"
:bg+2 "#5B5353"
:fg-4 "#72696A"
:fg-3 "#948A8B"
:fg-2 "#B5A9AA"
:fg-1 "#FFF1F3"
:fg "#FFF8F9"
;; General colors
:white "#ffffff"
:red "#FD6883"
:orange "#F38D70"
:yellow "#F9CC6C"
:green "#ADDA78"
:blue "#85DACC"
:purple "#A8A9EB"
:pink "#FD6883"))
(defvar monokai-pro-spectrum-theme-colors
'(;; Background and foreground colors
:bg "#222222"
:bg+1 "#363537"
:bg+2 "#525053"
:fg-4 "#69676C"
:fg-3 "#8B888F"
:fg-2 "#BAB6BF"
:fg-1 "#F7F1FF"
:fg "#FBF8FF"
;; General colors
:white "#ffffff"
:red "#FC618D"
:orange "#FD9353"
:yellow "#FCE566"
:green "#7BD88F"
:blue "#5AD4E6"
:purple "#948AE3"
:pink "#FC618D"))
(defvar monokai-pro-machine-theme-colors
'(;; Background and foreground colors
:bg "#273136"
:bg+1 "#3A4449"
:bg+2 "#545F62"
:fg-4 "#6B7678"
:fg-3 "#8B9798"
:fg-2 "#B4C3C4"
:fg-1 "#F2FFFC"
:fg "#F9FFFE"
;; General colors
:white "#ffffff"
:red "#FF6D7E"
:orange "#FFB270"
:yellow "#FFED72"
:green "#A2E57B"
:blue "#7CD5F1"
:purple "#BAA0F8"
:pink "#FF6D7E"))
(defvar monokai-pro-octagon-theme-colors
'(;; Background and foreground colors
:bg "#282A3A"
:bg+1 "#3A3D4B"
:bg+2 "#535763"
:fg-4 "#696D77"
:fg-3 "#888D94"
:fg-2 "#A0A5AE"
:fg-1 "#EAF2F1"
:fg "#F5F9F8"
;; General colors
:white "#ffffff"
:red "#FF657A"
:orange "#FF9B5E"
:yellow "#FFD76D"
:green "#BAD761"
:blue "#9CD1BB"
:purple "#C39AC9"
:pink "#FF657A"))
(defvar monokai-pro-classic-theme-colors
'(;; Background and foreground colors
:bg "#272821"
:bg+1 "#3B3C35"
:bg+2 "#57584F"
:fg-4 "#6E7066"
:fg-3 "#919288"
:fg-2 "#ABACA0"
:fg-1 "#FDFFF1"
:fg "#FEFFF8"
;; General colors
:white "#ffffff"
:red "#F82570"
:orange "#FC961F"
:yellow "#E4DB73"
:green "#A6E12D"
:blue "#66D9EE"
:purple "#AE81FF"
:pink "#F82570"))
(defun monokai-pro-theme-transform-spec (spec colors)
"Transform a theme `SPEC' into a face spec using `COLORS'."
(let ((output))
(while spec
(let* ((key (car spec))
(value (cadr spec))
(color-key (if (symbolp value) (intern (concat ":" (symbol-name value))) nil))
(color (plist-get colors color-key)))
;; Prepend the transformed element
(cond
((and (memq key '(:box :underline)) (listp value))
(push (monokai-pro-theme-transform-spec value colors) output))
(color
(push color output))
(t
(push value output)))
;; Prepend the actual key
(push key output)
;; Go to the next element in the list
(setq spec (cddr spec))))
;; Return the transformed spec
output))
(defun monokai-pro-theme-transform-face (spec colors)
"Transform a face `SPEC' into an Emacs theme face definition using `COLORS'."
(let* ((face (car spec))
(definition (cdr spec)))
(list face `((t ,(monokai-pro-theme-transform-spec definition colors))))))
(defun monokai-pro-theme-set-faces (theme-name colors faces)
"Define the important part of `THEME-NAME' using `COLORS' to map the `FACES' to actual colors."
(apply 'custom-theme-set-faces theme-name
(mapcar #'(lambda (face)
(monokai-pro-theme-transform-face face colors))
faces)))
(defvar monokai-pro-faces
'(
;;; Built-in
;;;; basic colors
;;(border :background bg+2)
(cursor :background fg)
(default :foreground fg :background bg)
;; TODO: bg matches what's in the sublime theme here, not bg+2
(fringe :background bg)
;;(gui-element :background bg+1)
(header-line :background nil :inherit mode-line)
;; vertical border
(vertical-border :foreground bg+1)
;; TODO: This matches highlight and findHighlight, but we may want
;; to look at findHighlightForeground which is simply bg.
(highlight :foreground fg-3 :background bg+1)
(link :foreground blue :underline t)
(link-visited :foreground purple :underline t)
(minibuffer-prompt :foreground fg)
(region :background bg+2)
(secondary-selection :background bg+2)
(trailing-whitespace :foreground fg :background red)
(widget-button :underline t)
(widget-field :background fg-1 :box (:line-width 1 :color bg+2))
(error :foreground red :weight bold)
(warning :foreground orange :weight bold)
(success :foreground green :weight bold)
;;;; font-lock
(font-lock-builtin-face :foreground purple)
(font-lock-comment-delimiter-face :foreground fg-3)
(font-lock-comment-face :foreground fg-3 :slant italic)
(font-lock-constant-face :foreground purple)
(font-lock-doc-face :foreground fg-3)
(font-lock-doc-string-face :foreground fg-3)
(font-lock-function-name-face :foreground green)
(font-lock-keyword-face :foreground pink)
;;(font-lock-negation-char-face :foreground fg-1)
;;(font-lock-preprocessor-face :foreground fg-1)
;;(font-lock-regexp-grouping-backslash :foreground fg-1)
;;(font-lock-regexp-grouping-construct :foreground fg)
(font-lock-string-face :foreground yellow)
(font-lock-type-face :foreground blue)
(font-lock-variable-name-face :foreground fg)
(font-lock-warning-face :foreground orange)
;;;; isearch
(match :foreground yellow :background bg :inverse-video t)
;; TODO: Revisit this - doesn't seem to map properly onto tmThemes
(isearch :foreground bg :background yellow :weight bold)
(lazy-highlight :foreground fg-1 :inverse-video t)
(isearch-fail :foreground red :background fg)
;;;; line-numbers
(line-number :foreground bg+2 :height 90)
(line-number-current-line :inherit line-number)
;;;; linum-mode
(linum :foreground bg+2 :inherit fringe)
(linum-highlight-face :foreground red :background bg)
(linum-relative-current-face :foreground red :background bg :weight bold)
;;;; mode-line
(mode-line :foreground fg-2 :background bg+1)
(mode-line-buffer-id :foreground yellow :background nil)
(mode-line-emphasis :foreground fg-1 :slant italic)
(mode-line-highlight :foreground fg :box nil :weight bold)
(mode-line-inactive :foreground fg-2 :background bg+2)
;;; term
(term-color-black :foreground bg+1)
(term-color-blue :foreground blue)
(term-color-cyan :foreground purple)
(term-color-green :foreground green)
(term-color-magenta :foreground pink)
(term-color-red :foreground red)
(term-color-white :foreground fg)
(term-color-yellow :foreground yellow)
;;; Third-party
;;; ivy
(ivy-action :foreground purple)
(ivy-confirm-face :foreground green)
(ivy-current-match :foreground bg :background yellow)
(ivy-cursor :foreground bg :background fg)
(ivy-grep-info :foreground pink)
(ivy-grep-line-number :foreground red)
(ivy-highlight-face :background bg+1 :foreground fg-1)
(ivy-match-required-face :foreground red)
(ivy-minibuffer-match-face-1 :foreground fg :background bg+1)
(ivy-minibuffer-match-face-2 :foreground fg :background bg+2)
(ivy-minibuffer-match-face-3 :foreground fg :background purple)
(ivy-minibuffer-match-face-4 :foreground fg :background pink)
(ivy-minibuffer-match-highlight :foreground fg-4 :background bg+1)
(ivy-modified-buffer :foreground fg)
(ivy-modified-outside-buffer :foreground fg)
(ivy-org :foreground bg+1 :slant italic)
(ivy-prompt-match :foreground bg :background yellow)
(ivy-remote :foreground purple)
(ivy-separator :foreground bg+1)
(ivy-subdir :foreground green)
(ivy-virtual :foreground purple)
(ivy-yanked-word :foreground fg-4 :background bg+1)
(swiper-background-match-face-1 :foreground bg :background fg)
(swiper-background-match-face-2 :foreground bg :background yellow)
(swiper-background-match-face-3 :foreground bg :background yellow :weight bold)
(swiper-background-match-face-4 :foreground red :background fg)
(swiper-match-face-1 :foreground bg :background fg)
(swiper-match-face-2 :foreground bg :background yellow)
(swiper-match-face-3 :foreground bg :background yellow :weight bold)
(swiper-match-face-4 :foreground red :background fg)
(swiper-line-face :foreground bg+2 :background bg+1)
;;; lsp-ui
(lsp-ui-doc-background :background bg+1)
(lsp-ui-peek-filename :foreground orange)
(lsp-ui-peek-header :foreground bg :background fg)
(lsp-ui-peek-footer :foreground bg :background fg)
(lsp-ui-peek-peek :foreground fg :background bg+1)
(lsp-ui-peek-highlight :foreground fg-1)
(lsp-ui-peek-selection :foreground fg-1 :background bg+2)
(lsp-ui-peek-list :background bg+1)
(lsp-ui-peek-line-number :foreground red)
;;; all-the-icons
(all-the-icons-red :foreground red)
(all-the-icons-blue :foreground blue)
(all-the-icons-green :foreground green)
(all-the-icons-yellow :foreground yellow)
(all-the-icons-purple :foreground purple)
(all-the-icons-pink :foreground pink)
(all-the-icons-orange :foreground orange)
;;;; php-mode
(php-block-delimiter :foreground fg-3)
(php-block-statement :foreground red)
(php-class-declaration-spec :foreground red)
(php-class-modifiers :foreground red)
(php-constant-assign :foreground red)
(php-constant-keyword :foreground purple)
(php-flow-control-statement :foreground red)
(php-import-declaration :foreground red)
(php-include-statement :foreground green)
(php-method-access :foreground red :slant italic)
(php-method-modifiers :foreground red :slant italic)
(php-method-static :foreground red :slant italic)
(php-namespace-declaration :foreground red)
(php-number :foreground purple)
(php-php-tag :foreground orange)
(php-print-statement :foreground green)
(php-property-access :foreground red :slant italic)
(php-property-const :foreground red :slant italic)
(php-property-static :foreground red :slant italic)
(php-string-quote :foreground fg-3)
(php-type-operator :foreground red)
(php-function-keyword :foreground blue :slant italic)
(php-function-name :foreground green)
(php-function-call :foreground green)
(php-string :foreground yellow)
(php-keyword :foreground blue)
(php-builtin :foreground purple)
(php-method-call :foreground green)
(php-static-method-call :foreground green)
(php-variable-name :foreground fg)
(php-property-name :foreground fg)
(php-variable-sigil :foreground fg-2)
(php-operator :foreground red)
(php-paamayim-nekudotayim :foreground red)
(php-type :foreground blue :slant italic)
(php-class :foreground red)
(php-constant :foreground purple)
(php-constant-assign :foreground blue)
(php-magical-constant :foreground purple)
(php-$this :foreground fg-2 :slant italic)
(php-$this-sigil :foreground fg-2 :slant italic)
(php-errorcontrol-op :foreground red)
(php-doc-annotation-tag :foreground blue)
(php-doc-variable-sigil :foreground fg-4)
(php-doc-$this :foreground fg-4)
(php-doc-$this-sigil :foreground fg-4)
(php-doc-class-name :foreground fg-4)
;;;; anzu-mode
;; (anzu-mode-line :foreground yellow)
;;;; company-mode
;; TODO: These don't feel quite right
(company-tooltip :background bg+1 :inherit default)
(company-scrollbar-bg :background bg+1)
(company-scrollbar-fg :background fg-1)
(company-tooltip-annotation :foreground red)
(company-tooltip-common :foreground yellow)
(company-box-selection :foreground fg-1 :background bg+2)
(company-tooltip-selection :background bg+2)
(company-preview-common :foreground fg-1 :background blue)
;;;; rainbow-delimiters
(rainbow-delimiters-depth-1-face :foreground red)
(rainbow-delimiters-depth-2-face :foreground pink)
(rainbow-delimiters-depth-3-face :foreground orange)
(rainbow-delimiters-depth-4-face :foreground yellow)
(rainbow-delimiters-depth-5-face :foreground green)
(rainbow-delimiters-depth-6-face :foreground blue)
(rainbow-delimiters-depth-7-face :foreground purple)
(rainbow-delimiters-depth-8-face :foreground fg-1)
(rainbow-delimiters-depth-9-face :foreground fg)
;;;; popup
(popup-menu-selection-face :background bg+1)
(popup-summary-face :background bg+2 :inherit default)
(popup-menu-face :background bg+2)
(popup-menu-mouse-face :background bg+1)
(popup-tip-face :background bg+2)
(popup-scroll-bar-background-face :background bg+1)
(popup-scroll-bar-foreground-face :background fg-1)
;;;; diff-hl-mode
(diff-hl-change :foreground blue)
(diff-hl-delete :foreground red)
(diff-hl-insert :foreground green)
;;;; diff-mode
(diff-added :foreground green)
(diff-changed :foreground purple)
(diff-removed :foreground red)
(diff-header :background bg)
(diff-file-header :background bg+1)
(diff-hunk-header :foreground pink :background bg)
;;;; flycheck-mode
(flycheck-error :box (:line-width 1 :color red))
(flycheck-info :box (:line-width 1 :color yellow))
(flycheck-warning :box (:line-width 1 :color orange))
(flycheck-fringe-error :foreground red)
(flycheck-fringe-info :foreground yellow)
(flycheck-fringe-warning :foreground orange)
;;;; flymake-mode
(flymake-error :box (:line-width 1 :color red))
(flymake-warning :box (:line-width 1 :color orange))
(flymake-note :box (:line-width 1 :color yellow))
;;;; flyspell-mode
(flyspell-duplicate :box (:line-width 1 :color orange))
(flyspell-incorrect :box (:line-width 1 :color red))
;;;; hl-line-mode
(hl-line :background bg+1)
;;;; ido-mode
;; TODO: These don't feel quite right
(ido-subdir :foreground fg-2)
(ido-first-match :foreground orange)
(ido-only-match :foreground green)
(ido-indicator :foreground red :background bg+2)
(ido-virtual :foreground fg-2)
;;;; ido-vertical-mode
(ido-vertical-match-face :foreground fg-1)
;;;; show-paren-mode
(show-paren-match :weight bold :foreground green)
(show-paren-mismatch :weight bold :foreground red)
))
(deftheme monokai-pro)
(monokai-pro-theme-set-faces
'monokai-pro
monokai-pro-theme-colors
monokai-pro-faces
)
;; Anything leftover that doesn't fall neatly into a face goes here.
(let ((bg (plist-get monokai-pro-theme-colors :bg))
(fg (plist-get monokai-pro-theme-colors :fg))
(red (plist-get monokai-pro-theme-colors :red))
(green (plist-get monokai-pro-theme-colors :green))
(yellow (plist-get monokai-pro-theme-colors :yellow))
(blue (plist-get monokai-pro-theme-colors :blue))
(magenta (plist-get monokai-pro-theme-colors :purple))
(cyan (plist-get monokai-pro-theme-colors :pink)))
(custom-theme-set-variables
'monokai-pro
`(ansi-color-names-vector
;; black, base08, base0B, base0A, base0D, magenta, cyan, white
[,bg ,red ,green ,yellow ,blue ,magenta ,cyan ,fg])
`(ansi-term-color-vector
;; black, base08, base0B, base0A, base0D, magenta, cyan, white
[unspecified ,bg ,red ,green ,yellow ,blue ,magenta ,cyan ,fg])))
;;;###autoload
(and load-file-name
(boundp 'custom-theme-load-path)
(add-to-list 'custom-theme-load-path
(file-name-as-directory
(file-name-directory load-file-name))))
(provide-theme 'monokai-pro)
(provide 'monokai-pro-theme)
;;; monokai-pro-theme.el ends here