diff options
Diffstat (limited to 'internal/server')
| -rw-r--r-- | internal/server/templates/index.html | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/internal/server/templates/index.html b/internal/server/templates/index.html index 025df89..1ba3177 100644 --- a/internal/server/templates/index.html +++ b/internal/server/templates/index.html @@ -1,12 +1,19 @@ <!DOCTYPE html> -<html lang="en"> +<html lang="en" class="dark"> <head> <script> // Theme detection - runs immediately before any rendering - if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { - document.documentElement.classList.add('dark'); + // 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 */ +{{.ThemeCSS}} + </style> + {{end}} <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{{.Site.Name}}</title> @@ -17,12 +24,6 @@ <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎐</text></svg>"> {{end}} <link rel="stylesheet" href="/static/style.css"> - {{if .ThemeCSS}} - <style> - /* OpenCode Theme */ -{{.ThemeCSS}} - </style> - {{end}} </head> <body class="bg-neutral-50 dark:bg-neutral-950 text-neutral-900 dark:text-neutral-100 min-h-screen font-mono"> <div class="max-w-4xl mx-auto px-4 py-8 sm:py-12"> |