API klici

This commit is contained in:
2026-04-20 14:43:50 +02:00
parent 737c7b92f3
commit a00028dbfa
6 changed files with 203 additions and 12 deletions

View File

@@ -1,5 +1,9 @@
(function() {
const saved = localStorage.getItem('theme') || 'light';
const osPref = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
document.documentElement.setAttribute('data-theme', saved ?? osPref);
try {
const saved = localStorage.getItem('theme');
const osPref = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
document.documentElement.setAttribute('data-theme', saved || osPref);
} catch (e) {
document.documentElement.setAttribute('data-theme', 'light');
}
})();