blob: b2451e819da195ba2c6a07a8eba08dd1c5215869 (
plain)
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
|
;;; dupre-palette.el --- Color palette for dupre-theme -*- lexical-binding: t -*-
;; Author: Craig Jennings <c@cjennings.net>
;;; Commentary:
;; This file defines the color palette and semantic mappings for dupre-theme.
;; Colors are defined as hex values for GUI Emacs.
;;; Code:
(defconst dupre-palette
'(;;; Base colors
(bg "#151311")
(bg+0 "#151311")
(bg+1 "#252321")
(bg+2 "#474544")
;; Grays
(gray-2 "#58574e")
(gray-1 "#6c6a60")
(gray "#969385")
(gray+1 "#b4b1a2")
(gray+2 "#d0cbc0")
;; Steel (blue-grays)
(steel "#8a9496")
(steel+1 "#acb0b3")
(steel+2 "#c0c7ca")
;; Blues
(blue "#67809c")
(blue+1 "#b2c3cc")
(blue+2 "#d9e2ff")
;; Greens
(green-2 "#646d14")
(green-1 "#869038")
(green "#a4ac64")
(green+1 "#ccc768")
;; Reds
(red-3 "#3f1c0f")
(red-2 "#7c2a09")
(red-1 "#a7502d")
(red "#d47c59")
(red+1 "#edb08f")
(red+2 "#edbca2")
;; Yellows
(yellow-2 "#875f00")
(yellow-1 "#ffd700")
(yellow "#d7af5f")
(yellow+1 "#ffd75f")
(yellow+2 "#f9ee98")
;; Intense/alert colors
(intense-red "#ff2a00")
;; Foreground
(fg "#f0fef0"))
"Color palette for dupre-theme.
Each entry is (NAME VALUE) where VALUE is a hex color string.")
(defconst dupre-semantic-mappings
'(;;; Status colors
(accent yellow)
(err intense-red)
(warning yellow+1)
(success green)
(info blue+1)
;;; Syntax highlighting
(keyword blue)
(string green)
(comment gray)
(constant yellow+1)
(function red)
(variable blue+1)
(type green+1)
(builtin yellow)
(preprocessor steel+1)
;;; UI elements
(border bg+2)
(selection bg+2)
(hl-line bg+0)
(link blue+1)
(cursor fg)
(prompt green)
;;; Diff colors
(diff-added-bg green-2)
(diff-added-fg green)
(diff-removed-bg red-3)
(diff-removed-fg red)
(diff-changed-bg yellow-2)
(diff-changed-fg yellow))
"Semantic color mappings for dupre-theme.
Each entry maps a semantic name to a palette color name.")
(defun dupre-get-color (name)
"Get the hex value for color NAME from the palette.
NAME can be a base palette color or a semantic mapping."
(let ((semantic (assq name dupre-semantic-mappings)))
(if semantic
;; Resolve semantic mapping to base color
(dupre-get-color (cadr semantic))
;; Look up in base palette
(let ((color (assq name dupre-palette)))
(if color
(cadr color)
(error "Unknown color: %s" name))))))
(defmacro dupre-with-colors (&rest body)
"Execute BODY with all palette colors bound as local variables."
(declare (indent 0))
`(let ,(mapcar (lambda (entry)
(list (car entry) (cadr entry)))
dupre-palette)
;; Also bind semantic mappings resolved to their values
(let ,(mapcar (lambda (entry)
(let* ((name (car entry))
(target (cadr entry))
(resolved (cadr (assq target dupre-palette))))
(list name resolved)))
dupre-semantic-mappings)
,@body)))
(provide 'dupre-palette)
;;; dupre-palette.el ends here
|