initial commit

This commit is contained in:
grassblock 2025-05-01 16:53:18 +08:00
commit 61511ed28c
28 changed files with 5210 additions and 0 deletions

View file

@ -0,0 +1,22 @@
---
---
<button class="theme-switcher" id="theme-switcher">
Toggle Theme
</button>
<script>
const themeSwitcher = document.getElementById('theme-switcher');
const root = document.documentElement;
// Check for saved theme preference or default to dark
const savedTheme = localStorage.getItem('theme') || 'dark';
root.setAttribute('data-theme', savedTheme);
themeSwitcher?.addEventListener('click', () => {
const currentTheme = root.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
root.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
});
</script>