Dark Mode folgt Browser-Einstellung (prefers-color-scheme), Toggle entfernt

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-13 12:34:56 +02:00
co-authored by Claude
parent e97d1b3687
commit 0c866805d3
10 changed files with 3 additions and 197 deletions
-19
View File
@@ -136,25 +136,6 @@
<script>
(function () {
const root = document.documentElement;
const dm = localStorage.getItem('darkMode');
if (dm === 'enabled' || (!dm && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
root.classList.add('dark');
}
const toggle = document.getElementById('darkModeToggle');
const sun = document.getElementById('sunIcon');
const moon = document.getElementById('moonIcon');
function sync() {
const d = root.classList.contains('dark');
if (sun) sun.classList.toggle('hidden', d);
if (moon) moon.classList.toggle('hidden', !d);
}
sync();
if (toggle) toggle.addEventListener('click', () => {
root.classList.toggle('dark');
localStorage.setItem('darkMode', root.classList.contains('dark') ? 'enabled' : 'disabled');
sync();
});
const cy = document.getElementById('currentYear');
if (cy) cy.textContent = new Date().getFullYear();
})();