Spaces:
Sleeping

DefakeNet / frontend /pages /_document.jsx
masp307's picture
Add deepfake models, UI, and backend
cc54add
Raw History Blame Contribute Delete
732 Bytes
import { Html, Head, Main, NextScript } from 'next/document';
// Ensures the correct theme class is applied before the app paints
const themeInitScript = `(() => {
try {
const stored = localStorage.getItem('theme');
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const theme = stored || (prefersDark ? 'dark' : 'light');
if (theme === 'dark') document.documentElement.classList.add('dark');
} catch (e) {}
})();`;
export default function Document() {
return (
<Html lang="en">
<Head />
<body>
<script dangerouslySetInnerHTML={{ __html: themeInitScript }} />
<Main />
<NextScript />
</body>
</Html>
);
}