BREAKING CHANGE: unify light mode identifier (#4652)

* chore: unify light mode identifier

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

Co-authored-by: charlie <xyhp915@qq.com>
Co-authored-by: Andelf <andelf@gmail.com>
This commit is contained in:
Yue Yang
2022-03-25 13:14:52 +08:00
committed by GitHub
parent 5997155d15
commit 1987d7dc79
8 changed files with 32 additions and 28 deletions

View File

@@ -892,7 +892,7 @@
[theme]
(set-state! :ui/theme theme)
(when (mobile-util/native-ios?)
(if (= theme "white")
(if (= theme "light")
(util/set-theme-light)
(util/set-theme-dark)))
(storage/set :ui/theme theme))
@@ -900,7 +900,7 @@
(defn sync-system-theme!
[]
(let [system-dark? (.-matches (js/window.matchMedia "(prefers-color-scheme: dark)"))]
(set-theme! (if system-dark? "dark" "white"))
(set-theme! (if system-dark? "dark" "light"))
(set-state! :ui/system-theme? true)
(storage/set :ui/system-theme? true)))
@@ -908,7 +908,7 @@
[theme-mode]
(if-not (= theme-mode "system")
(do
(set-theme! (if (= theme-mode "light") "white" theme-mode))
(set-theme! theme-mode)
(set-state! :ui/system-theme? false)
(storage/set :ui/system-theme? false))
(sync-system-theme!)))
@@ -924,7 +924,7 @@
(defn toggle-theme!
[]
(let [theme (:ui/theme @state)
theme' (if (= theme "dark") "white" "dark")]
theme' (if (= theme "dark") "light" "dark")]
(use-theme-mode! theme')))
(defn set-root-component!