From 2b2ddc9b0ea3c851163345dc46896f937002a01a Mon Sep 17 00:00:00 2001 From: whyour Date: Fri, 19 Mar 2021 21:19:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/index.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 8a0e45aa..284167c9 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -28,8 +28,12 @@ export default function (props: any) { useEffect(() => { const colorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches && 'dark'; - const theme = - localStorage.getItem('qinglong_dark_theme') || colorScheme || 'light'; + console.log(colorScheme); + let localTheme = localStorage.getItem('qinglong_dark_theme'); + if (localTheme === 'auto') { + localTheme = null; + } + const theme = localTheme || colorScheme || 'light'; setFetchMethod(window.fetch); if (theme === 'dark') { enableDarkMode({ darkSchemeTextColor: '#fff' }); @@ -45,7 +49,7 @@ export default function (props: any) { { + menuItemRender={(menuItemProps: any, defaultDom: any) => { if ( menuItemProps.isUrl || !menuItemProps.path ||