File tree Expand file tree Collapse file tree 2 files changed +44
-2
lines changed
Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 55@tailwind utilities;
66
77@layer base {
8+ /* Fallback for no-JS / first paint: respect system preference so no white flash on dark-mode browsers */
9+ @media (prefers-color-scheme : dark) {
10+ html : not ([data-theme = "light" ]) {
11+ --background : 222 47% 6% ;
12+ --foreground : 210 40% 96% ;
13+ --card : 222 44% 9% ;
14+ --card-foreground : 210 40% 96% ;
15+ --popover : 222 44% 9% ;
16+ --popover-foreground : 210 40% 96% ;
17+ --primary : 228 76% 60% ;
18+ --primary-foreground : 0 0% 100% ;
19+ --secondary : 217.2 32.6% 17.5% ;
20+ --secondary-foreground : 210 40% 98% ;
21+ --muted : 217.2 32.6% 17.5% ;
22+ --muted-foreground : 215 20.2% 65.1% ;
23+ --accent : 228 76% 60% ;
24+ --accent-foreground : 0 0% 100% ;
25+ --border : 217.2 32.6% 17.5% ;
26+ --input : 217.2 32.6% 17.5% ;
27+ --ring : 228 76% 60% ;
28+ }
29+ }
30+
831 : root {
932 --background : 0 0% 100% ;
1033 --foreground : 222 47% 11% ;
Original file line number Diff line number Diff line change @@ -27,8 +27,27 @@ export default function RootLayout({
2727 children : React . ReactNode ;
2828} > ) {
2929 return (
30- < html lang = "en" suppressHydrationWarning >
31- < body >
30+ < html lang = "en" suppressHydrationWarning className = "bg-background" >
31+ < head >
32+ < script
33+ dangerouslySetInnerHTML = { {
34+ __html : `
35+ (function() {
36+ var theme = localStorage.getItem('theme');
37+ var systemDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
38+ if (theme === 'dark' || (theme !== 'light' && systemDark)) {
39+ document.documentElement.classList.add('dark');
40+ document.documentElement.setAttribute('data-theme', 'dark');
41+ } else {
42+ document.documentElement.classList.remove('dark');
43+ document.documentElement.setAttribute('data-theme', 'light');
44+ }
45+ })();
46+ ` ,
47+ } }
48+ />
49+ </ head >
50+ < body className = "bg-background text-foreground min-h-screen" >
3251 < a href = "#main-content" className = "skip-link" >
3352 Skip to content
3453 </ a >
You can’t perform that action at this time.
0 commit comments