summaryrefslogtreecommitdiff
path: root/bin/modus2css.el
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-02-11 04:35:36 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-02-11 04:47:51 +0000
commitb4a99a8123e953504160a78466a5cc27c8bb066f (patch)
tree41b6c5a8f36c73adbe2f13016e40fe153be4c252 /bin/modus2css.el
parentadd po4a.cfg (diff)
downloadmichalec-dev-b4a99a8123e953504160a78466a5cc27c8bb066f.tar.gz
add scripts
Diffstat (limited to 'bin/modus2css.el')
-rw-r--r--bin/modus2css.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/modus2css.el b/bin/modus2css.el
new file mode 100644
index 0000000..d6a57c8
--- /dev/null
+++ b/bin/modus2css.el
@@ -0,0 +1,24 @@
1(defun mapping2css (mapping)
2 (let* ((key (symbol-name (car mapping)))
3 (value (cadr mapping))
4 (color (pcase value
5 ((pred stringp) value)
6 ('unspecified "none")
7 ((pred symbolp) (concat "var(--" (symbol-name value) ")")))))
8 (concat "--" key ": " color ";")))
9
10(with-current-buffer (get-buffer-create "*modus2css*")
11 (insert
12 (string-join
13 `(":root {"
14 ,@(mapcar (lambda (line) (concat " " line))
15 (mapcar 'mapping2css (modus-themes-get-theme-palette 'modus-operandi t t)))
16 "}"
17 ""
18 "@media (prefers-color-scheme: dark) {"
19 " :root {"
20 ,@(mapcar (lambda (line) (concat " " line))
21 (mapcar 'mapping2css (modus-themes-get-theme-palette 'modus-vivendi t t)))
22 " }"
23 "}")
24 "\n")))