Files
vantage/site/components/ThemeScript.tsx
T
mrhid6 693d59a3e2
Server Deploy / deploy (push) Successful in 5m51s
feat: Marketing site
2026-07-22 16:50:13 +01:00

17 lines
468 B
TypeScript

// Applies the stored theme before first paint. Without this the page renders in
// the OS theme for a frame and then snaps to the stored one.
const script = `
(function(){
try {
var t = localStorage.getItem("vantage-theme");
if (t === "light" || t === "dark") {
document.documentElement.setAttribute("data-theme", t);
}
} catch (e) {}
})();
`;
export function ThemeScript() {
return <script dangerouslySetInnerHTML={{ __html: script }} />;
}