SPB Git

spb/autoscholar

Public
524 B · 7 lines tsx
1/** Applies the stored theme before paint to avoid a flash; inline script is allowed by CSP (unsafe-inline for scripts). */2export function ThemeScript() {3  const code = `(function(){try{var s=localStorage.getItem('as-theme');var d=s?s==='dark':window.matchMedia('(prefers-color-scheme: dark)').matches;if(d)document.documentElement.classList.add('dark');}catch(e){}})();`;4  // biome-ignore lint/security/noDangerouslySetInnerHtml: static, constant script5  return <script dangerouslySetInnerHTML={{ __html: code }} />;6}7
Files · cf174810baa9fec822f36c2d1dff7efc3e0bec61
Menu

Theme