Browse Source

enhance: persist theme state when toggling theme with `t t` shortcut

charlie 4 years ago
parent
commit
194ef4cc56
2 changed files with 3 additions and 3 deletions
  1. 2 2
      src/main/frontend/state.cljs
  2. 1 1
      src/main/frontend/ui.cljs

+ 2 - 2
src/main/frontend/state.cljs

@@ -775,7 +775,7 @@
   [theme-mode]
   (if-not (= theme-mode "system")
     (do
-      (set-theme! (if (= theme-mode "light") "white" "dark"))
+      (set-theme! (if (= theme-mode "light") "white" theme-mode))
       (set-state! :ui/system-theme? false)
       (storage/set :ui/system-theme? false))
     (sync-system-theme!)))
@@ -796,7 +796,7 @@
   []
   (let [theme (:ui/theme @state)
         theme' (if (= theme "dark") "white" "dark")]
-    (set-theme! theme')))
+    (use-theme-mode! theme')))
 
 (defn- file-content-key
   [repo path]

+ 1 - 1
src/main/frontend/ui.cljs

@@ -288,7 +288,7 @@
   []
   (let [^js schemaMedia (js/window.matchMedia "(prefers-color-scheme: dark)")]
     (.addEventListener schemaMedia "change" state/sync-system-theme!)
-    ;; (state/sync-system-theme!)
+    (state/sync-system-theme!)
     #(.removeEventListener schemaMedia "change" state/sync-system-theme!)))
 
 (defn on-scroll