Skip to content

Commit b7ce6f9

Browse files
committed
bug fixes
1 parent a607f39 commit b7ce6f9

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

web-next/app/globals.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ html.dark,
200200
transition: none !important;
201201
}
202202

203+
/* Ensure color-scheme is properly set to prevent browser default styles flash */
204+
html {
205+
color-scheme: light;
206+
}
207+
208+
html.dark {
209+
color-scheme: dark;
210+
}
211+
203212
* {
204213
@apply border-border outline-ring/50;
205214
}

web-next/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function RootLayout({
5252
<head>
5353
<script
5454
dangerouslySetInnerHTML={{
55-
__html: `(function(){try{let t=localStorage.getItem('theme'),d=window.matchMedia('(prefers-color-scheme: dark)').matches;if(t==='dark'||(t!=='light'&&!t&&d)){document.documentElement.classList.add('dark');document.documentElement.classList.remove('light')}else if(t==='light'){document.documentElement.classList.add('light');document.documentElement.classList.remove('dark')}else{document.documentElement.classList.remove('dark','light')}}catch(e){}})()`,
55+
__html: `(function(){try{let t=localStorage.getItem('theme')||'system',d=window.matchMedia('(prefers-color-scheme: dark)').matches;document.documentElement.style.colorScheme=t==='system'?(d?'dark':'light'):t;if(t==='dark'||(t==='system'&&d)){document.documentElement.classList.add('dark');document.documentElement.classList.remove('light')}else if(t==='light'||(t==='system'&&!d)){document.documentElement.classList.add('light');document.documentElement.classList.remove('dark')}}catch(e){}})()`,
5656
}}
5757
/>
5858
</head>

web-next/components/theme-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function ThemeProvider({
1010
return (
1111
<NextThemesProvider
1212
{...props}
13-
enableColorScheme={false}
13+
enableColorScheme
1414
>
1515
{children}
1616
</NextThemesProvider>

0 commit comments

Comments
 (0)