1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-12-04 18:56:44 +01:00
archivr/frontend/public/theme-init.js

9 lines
357 B
JavaScript

(function () {
try {
var stored = localStorage.getItem('archivr-theme');
var isDark = stored === 'dark' || (stored !== 'light' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
document.documentElement.dataset.theme = isDark ? 'dark' : 'light';
} catch (e) {
/* ignore storage access error */
}
})();