-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpunch-line-colors.el
212 lines (174 loc) · 6.84 KB
/
punch-line-colors.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
;;; punch-line-colors.el --- A customized mode-line for Emacs with modal status and advanced customizations -*- lexical-binding: t; -*-
;; Author: Mikael Konradsson
;; Version: 1.0
;; Package-Requires: ((emacs "28.1"))
;;; Commentary:
;;; Code:
;;; Evil faces
(defface punch-line-evil-normal-face
`((t :foreground "#FFFFFF" :background "#2D4F67" :weight bold))
"Face for Evil normal state."
:group 'punch-line)
(defface punch-line-evil-insert-face
`((t :foreground "#333333" :background "#E6C384" :weight bold))
"Face for Evil insert state."
:group 'punch-line)
(defface punch-line-evil-visual-face
`((t :foreground "#333333" :background "#D27E99" :weight bold))
"Face for Evil visual state."
:group 'punch-line)
(defface punch-line-evil-replace-face
`((t :foreground "#333333" :background "#FF5D62" :weight bold))
"Face for Evil replace state."
:group 'punch-line)
(defface punch-line-evil-emacs-face
`((t :foreground "#333333" :background "#B0C4DE" :weight bold))
"Face for Emacs state."
:group 'punch-line)
(defface punch-line-macro-face
`((t :foreground "#333333" :background "#B0C4DE" :weight bold))
"Face for Emacs state."
:group 'punch-line)
(defface punch-line-macro-recording-face
`((t :foreground "#222233" :background "#FF5D62" :weight bold))
"Face for Emacs state."
:group 'punch-line)
(defface punch-line-meow-motion-face
`((t :foreground "#333333" :background "#B0C4DE" :weight bold))
"Face for Emacs state."
:group 'punch-line)
(defface punch-line-meow-keypad-face
`((t :foreground "#333333" :background "#D27E99" :weight bold))
"Face for Emacs state."
:group 'punch-line)
(defface punch-line-meow-insert-exit-face
`((t :foreground "#333333" :background "#E6C384" :weight bold))
"Face for Emacs state."
:group 'punch-line)
;;; Git faces
(defface punch-line-git-edited-face
'((t :foreground "#658594"))
"Face for edited Git files."
:group 'punch-line)
(defface punch-line-git-added-face
'((t :foreground "#50FA7B"))
"Face for added Git files."
:group 'punch-line)
(defface punch-line-git-removed-face
'((t :foreground "#FF5D62"))
"Face for removed Git files."
:group 'punch-line)
(defface punch-line-git-conflict-face
'((t :foreground "#FF79C6"))
"Face for Git conflicts."
:group 'punch-line)
(defface punch-line-inactive-face
'((t :inherit mode-line-inactive))
"Face for inactive mode-line elements."
:group 'punch-line)
(defface punch-line-buffer-name-face
'((t :inherit mode-line-buffer-id ))
"Face for buffer name."
:group 'punch-line)
(defface punch-line-major-mode-face
'((t :inherit font-lock-doc-face :weight bold))
"Face for major mode."
:group 'punch-line)
(defface punch-line-position-face
'((t :foreground "#FFA07A"))
"Face for buffer position."
:group 'punch-line)
(defface punch-line-time-face
'((t :inherit mode-line-buffer-id))
"Face for time display."
:group 'punch-line)
(defface punch-line-git-face
'((t :foreground "#a0a0ae"))
"Standard face for Git information."
:group 'punch-line)
(defface punch-line-project-face
'((t :foreground "#FFA066" :weight bold))
"Standard face for project information."
:group 'punch-line)
(defface punch-line-lsp-icon-face
'((t :inherit lsp-mode-line))
"Standard face for project information."
:group 'punch-line)
(defface punch-line-separator-face
'((t :foreground "#54536D" :weight thin))
"Face for the separator between sections in punch-line."
:group 'punch-line)
(defface punch-line-what-am-i-doing-face
'((t :inherit mode-line-emphasis))
"Face for the separator between sections in punch-line."
:group 'punch-line)
(defface punch-line-what-am-i-doing-count-face
'((t :inherit success))
"Face for displaying current task in mode line."
:group 'punch-line)
(defface punch-line-system-monitor-cpu-face
'((t :inherit font-lock-constant-face))
"Face for CPU usage in system monitor."
:group 'punch-line)
(defface punch-line-system-monitor-memory-face
'((t :inherit font-lock-function-call-face))
"Face for memory usage in system monitor."
:group 'punch-line)
(defface punch-line-music-face
'((t (:inherit font-lock-comment-face)))
"Face for inactive mode-line elements."
:group 'punch-line)
(defface punch-line-music-apple-face
'((t (:foreground "#ff2d55")))
"Face for apple music mode-line elements."
:group 'punch-line)
(defface punch-line-music-spotify-face
'((t (:foreground "#1db954")))
"Face for spotify mode-line elements."
:group 'punch-line)
(require 'cl-lib)
(cl-defun adjust-colors (base-face &key background-adjust foreground-adjust
background-color foreground-color
weight slant underline overline strike-through
box inverse-video stipple)
"Generate a face specification based on BASE-FACE with adjustments.
Adjusts background by BACKGROUND-ADJUST percent (-100 to 100).
Adjusts foreground by FOREGROUND-ADJUST percent (-100 to 100).
Can set specific BACKGROUND-COLOR and/or FOREGROUND-COLOR.
Additional face attributes (WEIGHT, SLANT, etc.) can be specified."
(let* ((base-face-attrs (face-all-attributes base-face nil))
(bg (or background-color
(and background-adjust
(adjust-color (or (face-background base-face nil t) "unspecified")
background-adjust))
(face-background base-face nil t)))
(fg (or foreground-color
(and foreground-adjust
(adjust-color (or (face-foreground base-face nil t) "unspecified")
foreground-adjust))
(face-foreground base-face nil t)))
(spec `(,@base-face-attrs
,@(when bg `(:background ,bg))
,@(when fg `(:foreground ,fg))
,@(when weight `(:weight ,weight))
,@(when slant `(:slant ,slant))
,@(when underline `(:underline ,underline))
,@(when overline `(:overline ,overline))
,@(when strike-through `(:strike-through ,strike-through))
,@(when box `(:box ,box))
,@(when inverse-video `(:inverse-video ,inverse-video))
,@(when stipple `(:stipple ,stipple)))))
spec))
(defun adjust-color (color percent)
"Adjust COLOR by PERCENT (-100 to 100)."
(if (string= color "unspecified")
color
(let* ((rgb (color-name-to-rgb color))
(adjusted-rgb (mapcar (lambda (comp)
(if (> percent 0)
(min 1.0 (+ comp (* (- 1.0 comp) (/ percent 100.0))))
(max 0.0 (+ comp (* comp (/ percent 100.0))))))
rgb)))
(apply 'color-rgb-to-hex adjusted-rgb))))
(provide 'punch-line-colors)
;;; punch-line-colors.el ends here