Add css variables and theme switch

This commit is contained in:
Eva 2023-03-01 16:00:34 +01:00 committed by Alonso Torres
parent b77f85b697
commit adffdb31f3
42 changed files with 225 additions and 60 deletions

View file

@ -58,10 +58,10 @@
(.setAttribute (.querySelector js/document "html") "lang" lang))
(defn set-html-theme-color
[^string color scheme]
(let [meta-node (.querySelector js/document "meta[name='theme-color']")]
(.setAttribute meta-node "content" color)
(.setAttribute meta-node "media" (str/format "(prefers-color-scheme: %s)" scheme))))
[^string color]
(let [node (.querySelector js/document "body")]
(.removeAttribute node "class")
(.add ^js (.-classList ^js node) color)))
(defn set-page-style!
[styles]