diff options
| author | Fuwn <[email protected]> | 2026-01-20 05:04:23 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-20 05:04:23 -0800 |
| commit | 44a6f0c5acb1984b9565b0c093898a99b9330d81 (patch) | |
| tree | 1d20916424ec88209604a171f60e3d73070be39b /internal/server/templates/index.html | |
| parent | chore: Add justfile (diff) | |
| download | kaze-44a6f0c5acb1984b9565b0c093898a99b9330d81.tar.xz kaze-44a6f0c5acb1984b9565b0c093898a99b9330d81.zip | |
refactor: Use CSS prefers-color-scheme instead of JS-based theme toggle
Diffstat (limited to 'internal/server/templates/index.html')
| -rw-r--r-- | internal/server/templates/index.html | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/internal/server/templates/index.html b/internal/server/templates/index.html index 1ba3177..9d98b44 100644 --- a/internal/server/templates/index.html +++ b/internal/server/templates/index.html @@ -1,13 +1,6 @@ <!DOCTYPE html> -<html lang="en" class="dark"> +<html lang="en"> <head> - <script> - // Theme detection - runs immediately before any rendering - // Default is dark (set on html element above), switch to light only if explicitly set - if (localStorage.theme === 'light' || (localStorage.theme !== 'dark' && window.matchMedia('(prefers-color-scheme: light)').matches)) { - document.documentElement.classList.remove('dark'); - } - </script> {{if .ThemeCSS}} <style> /* OpenCode Theme - Loaded before external CSS to prevent flash */ @@ -39,16 +32,7 @@ <p class="text-sm text-neutral-500 dark:text-neutral-400">{{.Site.Description}}</p> </div> </div> - {{if .ShowThemeToggle}} - <button onclick="toggleTheme()" class="p-2 rounded-md hover:bg-neutral-200 dark:hover:bg-neutral-800 transition-colors" aria-label="Toggle theme"> - <svg class="w-5 h-5 hidden dark:block" fill="none" stroke="currentColor" viewBox="0 0 24 24"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"/> - </svg> - <svg class="w-5 h-5 block dark:hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"/> - </svg> - </button> - {{end}} + </div> </header> @@ -210,16 +194,6 @@ <div id="tooltip" class="tooltip"></div> <script> - function toggleTheme() { - if (document.documentElement.classList.contains('dark')) { - document.documentElement.classList.remove('dark'); - localStorage.theme = 'light'; - } else { - document.documentElement.classList.add('dark'); - localStorage.theme = 'dark'; - } - } - // Group collapse/expand functionality function toggleGroup(groupName) { const content = document.querySelector('[data-group-content="' + groupName + '"]'); |