From b4a99a8123e953504160a78466a5cc27c8bb066f Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Wed, 11 Feb 2026 07:35:36 +0300 Subject: add scripts --- bin/modus2css.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 bin/modus2css.el (limited to 'bin/modus2css.el') 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 @@ +(defun mapping2css (mapping) + (let* ((key (symbol-name (car mapping))) + (value (cadr mapping)) + (color (pcase value + ((pred stringp) value) + ('unspecified "none") + ((pred symbolp) (concat "var(--" (symbol-name value) ")"))))) + (concat "--" key ": " color ";"))) + +(with-current-buffer (get-buffer-create "*modus2css*") + (insert + (string-join + `(":root {" + ,@(mapcar (lambda (line) (concat " " line)) + (mapcar 'mapping2css (modus-themes-get-theme-palette 'modus-operandi t t))) + "}" + "" + "@media (prefers-color-scheme: dark) {" + " :root {" + ,@(mapcar (lambda (line) (concat " " line)) + (mapcar 'mapping2css (modus-themes-get-theme-palette 'modus-vivendi t t))) + " }" + "}") + "\n"))) -- cgit v1.3