SPB Git

spb/market-atlas

Public
462 B · 4 lines typescript
1/** Inline script run in <head> before paint: applies the persisted theme so the first frame is right. */2export const THEME_KEY = "ma-theme";3export const THEME_SCRIPT = `(function(){try{var k='${THEME_KEY}',p=localStorage.getItem(k),m=window.matchMedia('(prefers-color-scheme: dark)'),t=(p==='light'||p==='dark')?p:(m.matches?'dark':'light');document.documentElement.setAttribute('data-theme',t);document.documentElement.style.colorScheme=t;}catch(e){}})();`;4
Files · 13f4147334586e6331d2b6128a57514d66072bde
Menu

Theme