remove theme init script

This commit is contained in:
2026-05-29 21:22:20 +02:00
parent ce9bc0314c
commit aa4e1844a3
+1 -4
View File
@@ -7,8 +7,6 @@ import Header from "../components/Header";
import appCss from "../styles.css?url"; import appCss from "../styles.css?url";
const THEME_INIT_SCRIPT = `(function(){try{var stored=window.localStorage.getItem('theme');var mode=(stored==='light'||stored==='dark'||stored==='auto')?stored:'auto';var prefersDark=window.matchMedia('(prefers-color-scheme: dark)').matches;var resolved=mode==='auto'?(prefersDark?'dark':'light'):mode;var root=document.documentElement;root.classList.remove('light','dark');root.classList.add(resolved);if(mode==='auto'){root.removeAttribute('data-theme')}else{root.setAttribute('data-theme',mode)}root.style.colorScheme=resolved;}catch(e){}})();`;
export const Route = createRootRoute({ export const Route = createRootRoute({
head: () => ({ head: () => ({
meta: [ meta: [
@@ -37,10 +35,9 @@ function RootDocument({ children }: { children: ReactNode }) {
return ( return (
<html lang="en" suppressHydrationWarning> <html lang="en" suppressHydrationWarning>
<head> <head>
<script dangerouslySetInnerHTML={{ __html: THEME_INIT_SCRIPT }} />
<HeadContent /> <HeadContent />
</head> </head>
<body className="font-sans antialiased [overflow-wrap:anywhere] selection:bg-[rgba(79,184,178,0.24)]"> <body className="font-sans antialiased [overflow-wrap:anywhere]">
<Header /> <Header />
{children} {children}
<Footer /> <Footer />