Colorize: Add dark mode with system/dark/light toggle

- Add prefers-color-scheme: dark media query for automatic dark mode
- Add data-theme attribute for manual override (persisted to localStorage)
- 3-state cycle: system → dark → light → system
- Theme toggle button in nav with contextual icon (sun/moon/half)
- Dark palette: slate-900 bg, slate-800 surfaces, adjusted text/accent/success/danger

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
fahed
2026-03-25 18:29:39 +03:00
parent 0df13abfee
commit 784a914ebf
2 changed files with 104 additions and 0 deletions

View File

@@ -33,6 +33,70 @@
--radius: 12px;
}
/* Dark mode */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #0f172a;
--surface: #1e293b;
--border: #334155;
--text-primary: #f1f5f9;
--text-secondary: #cbd5e1;
--text-muted: #94a3b8;
--accent: #3b82f6;
--primary: #3b82f6;
--accent-light: #1e3a5f;
--success: #34d399;
--success-light: #064e3b;
--danger: #f87171;
--danger-light: #7f1d1d;
--brand-icon: #60a5fa;
--brand-text: #93c5fd;
--text-inverse: #0f172a;
--warning-bg: #451a03;
--warning-text: #fbbf24;
--warning-border: #78350f;
--accent-hover: #60a5fa;
--purple: #a78bfa;
--muted-light: #1e293b;
--dark-surface: #0f172a;
--dark-muted: #64748b;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
--shadow: 0 4px 12px rgba(0,0,0,0.4);
color-scheme: dark;
}
}
/* Manual theme override */
:root[data-theme="dark"] {
--bg: #0f172a;
--surface: #1e293b;
--border: #334155;
--text-primary: #f1f5f9;
--text-secondary: #cbd5e1;
--text-muted: #94a3b8;
--accent: #3b82f6;
--primary: #3b82f6;
--accent-light: #1e3a5f;
--success: #34d399;
--success-light: #064e3b;
--danger: #f87171;
--danger-light: #7f1d1d;
--brand-icon: #60a5fa;
--brand-text: #93c5fd;
--text-inverse: #0f172a;
--warning-bg: #451a03;
--warning-text: #fbbf24;
--warning-border: #78350f;
--accent-hover: #60a5fa;
--purple: #a78bfa;
--muted-light: #1e293b;
--dark-surface: #0f172a;
--dark-muted: #64748b;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
--shadow: 0 4px 12px rgba(0,0,0,0.4);
color-scheme: dark;
}
* {
margin: 0;
padding: 0;