()
| 13 | |
| 14 | // 检测系统主题 |
| 15 | const getSystemTheme = (): "light" | "dark" => { |
| 16 | if (typeof window === "undefined") return "light"; |
| 17 | return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; |
| 18 | }; |
| 19 | |
| 20 | // 应用主题 |
| 21 | const applyTheme = (newTheme: Theme) => { |