19 lines
715 B
JavaScript
19 lines
715 B
JavaScript
/*
|
|
No-flash theme init (external so a strict CSP can use script-src 'self' with no
|
|
inline hash). Loaded render-blocking in <head>, runs before first paint: marks
|
|
that JS is available (reveal animations are gated behind html.js) and applies the
|
|
stored or system theme. First visit follows the system; once set, the choice persists.
|
|
*/
|
|
(function () {
|
|
document.documentElement.classList.add('js');
|
|
try {
|
|
var t = localStorage.getItem('theme');
|
|
if (t !== 'light' && t !== 'dark') {
|
|
t = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
|
}
|
|
document.documentElement.dataset.theme = t;
|
|
} catch {
|
|
document.documentElement.dataset.theme = 'dark';
|
|
}
|
|
})();
|