Study/web/public/theme.js
Elijah 74a98ac1f1 Add the V2 web app: design system, shell, study flows, AI, settings, sharing
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 08:53:01 -07:00

10 lines
455 B
JavaScript

// Applies the saved theme before first paint (kept as a file so the CSP can stay script-src 'self').
(function () {
try {
var saved = localStorage.getItem('sd.theme') || 'system';
var dark = saved === 'dark' || (saved === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches);
document.documentElement.dataset.theme = dark ? 'dark' : 'light';
} catch (e) {
document.documentElement.dataset.theme = 'light';
}
})();