summaryrefslogtreecommitdiff
path: root/.config/emacs/mango-theme.el
blob: 7e74d17e92fef59b3c6d379bfdc746ce2b7ec8f3 (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
;;; mango-theme.el --- Just your average dark theme  -*- lexical-binding: t -*-

;; Copyright © 2023 Thomas Voss

;; Author: Thomas Voss <mail@thomasvoss.com>
;; Maintainer: Thomas Voss <mail@thomasvoss.com>
;; URL: https://git.sr.ht/~mango/mango-theme
;; Mailing-List: https://lists.sr.ht/~mango/public-inbox

;;; License:

;; Permission to use, copy, modify, and/or distribute this software for any
;; purpose with or without fee is hereby granted.
;;
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
;; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
;; AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
;; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
;; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
;; OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
;; PERFORMANCE OF THIS SOFTWARE.

;;; Commentary:

;; TODO

;;; Code:

(deftheme mango
  "Just another dark theme because none of the other options out there were just
as I would like them.  Why try to fix someone elses themes when I make my own?")

(defun mango-theme--get-color (name)
  "Get the RGB value of the color NAME from ‘mango-theme-palette’"
  (cadr (assq name mango-theme-palette)))

(defmacro mango-theme--generate-set-faces (&rest body)
  "A macro to provide a much simpler syntax than what is expected by
‘custom-theme-set-faces’.  This is possible because I only run Emacs
graphically, so I shouldn’t need to have multiple specs per face.

\(fn SPEC...)"
  (declare (indent 0))
  (let ((ret '('mango custom-theme-set-faces)))
    (dolist (spec body)
      (add-to-list 'ret `(backquote ,(list (car spec) `((t ,(cdr spec)))))))
    (reverse ret)))

(defconst mango-theme-palette
  '((foreground       "#C5C8C6")
    (background       "#2B303B")
    (background-cool  "#363C4A")
    (background-faint "#414859")
    (middleground     "#4F5561")
    (disabled         "#999999")
    (pale-azure       "#9CDCFE")
    (celestial-blue   "#569CD6")
    (violet           "#E57AE5")
    (khaki            "#F0E68C")
    (lime             "#B8F182")
    (orange           "#F1B282")
    (citron           "#ED97F5")))

(mango-theme--generate-set-faces
  ;; Standard Stuff
  (default
   :foreground ,(mango-theme--get-color 'foreground)
   :background ,(mango-theme--get-color 'background))
  (fringe
   :inherit default)

  ;; Lines
  (hl-line
   :background ,(mango-theme--get-color 'background-faint))
  (region
   :background ,(mango-theme--get-color 'middleground))
  (mode-line
   :background ,(mango-theme--get-color 'middleground))
  (mode-line-inactive
   :background ,(mango-theme--get-color 'background-cool)
   :weight light)

  ;; Line Numbers
  (line-number
   :background ,(mango-theme--get-color 'background-cool))
  (line-number-current-line
   :background ,(mango-theme--get-color 'background-cool)
   :weight bold)

  ;; Documentation
  (font-lock-comment-face
   :foreground ,(mango-theme--get-color 'disabled))
  (font-lock-doc-face
   :inherit font-lock-comment-face)

  ;; Core Language
  (font-lock-keyword-face
   :foreground ,(mango-theme--get-color 'violet))
  (font-lock-type-face
   :foreground ,(mango-theme--get-color 'celestial-blue))
  (font-lock-builtin-face
   :inherit font-lock-preprocessor-face)

  ;; Function-likes
  (font-lock-function-name-face
   :foreground ,(mango-theme--get-color 'khaki))
  (font-lock-preprocessor-face
   :foreground ,(mango-theme--get-color 'citron)
   :weight bold)

  ;; Variables
  (font-lock-variable-name-face
   :foreground ,(mango-theme--get-color 'pale-azure))
  (font-lock-constant-face
   :inherit font-lock-variable-name-face
   :weight bold)

  ;; Org Mode
  (org-code
   :foreground ,(mango-theme--get-color 'orange))
  (org-verbatim
   :foreground ,(mango-theme--get-color 'lime))
  (org-block
   :background ,(mango-theme--get-color 'background-cool))
  (org-hide
   :foreground ,(mango-theme--get-color 'background))

  ;; Info Page
  (Info-quoted
   :inherit default))