Skip to content

Commit

Permalink
fix: color mode not auto set
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Apr 19, 2024
1 parent cf3e8ab commit 5abe90e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions composables/useThemeMode.ts
Expand Up @@ -23,7 +23,7 @@
* questions.
*/

import { BrowserUtil } from "zhi-device"
import { BrowserUtil, SiyuanDevice } from "zhi-device"
import { createAppLogger } from "~/common/appLogger"
import { useSettingStore } from "~/stores/useSettingStore"

Expand Down Expand Up @@ -68,17 +68,19 @@ export const useThemeMode = async () => {
}

// 在 mounted 生命周期中处理加载后逻辑
// onMounted(() => {
// })
onMounted(() => {})

const setting = await getSetting()
const siyuanV = "2.9.1"
const hljsV = "11.5.0"
const siyuanLightTheme = setting?.theme?.lightTheme ?? "Zhihu"
const siyuanDarkTheme = setting?.theme?.darkTheme ?? "Zhihu"
const siyuanThemeV = "0.0.7"
const detectedMode = setting?.theme?.mode ?? color.preference
const isDarkMode = detectedMode === "dark"
const win = SiyuanDevice.siyuanWindow()
const isDarkMode = win.matchMedia("(prefers-color-scheme: dark)").matches
const detectedMode = isDarkMode ? "dark" : "light"
// const detectedMode setting?.theme?.mode ?? color.preference
// const isDarkMode = detectedMode === "dark"
useHead({
htmlAttrs: {
lang: setting.lang ?? "zh_CN",
Expand Down

0 comments on commit 5abe90e

Please sign in to comment.