Add dark mode based on device color-scheme preference

Move the color palette into CSS custom properties (:root in
globals.scss) with a prefers-color-scheme: dark override, and point the
existing $color-* Sass variables at them so every component picks up
dark mode automatically. Replaced the handful of rgba($color, alpha)
call sites with color-mix(), since Sass can't alpha-blend a color that's
now a CSS variable at compile time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-13 19:33:31 +02:00
co-authored by Claude Sonnet 5
parent a716080f7d
commit 370e77f1a6
4 changed files with 45 additions and 13 deletions
+28
View File
@@ -1,5 +1,33 @@
@use './variables' as *;
:root {
--color-text: #1a1a1a;
--color-text-muted: #6b6b6b;
--color-background: #ffffff;
--color-surface: #f7f7f5;
--color-border: #e2e0dc;
--color-primary: #b5432b;
--color-primary-contrast: #ffffff;
--color-danger: #a33333;
--color-success: #2f7a4f;
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root {
--color-text: #f2ede6;
--color-text-muted: #a89e8f;
--color-background: #16130f;
--color-surface: #201c17;
--color-border: #3a342a;
--color-primary: #d9694a;
--color-primary-contrast: #ffffff;
--color-danger: #ef6b62;
--color-success: #4fbb7c;
color-scheme: dark;
}
}
*,
*::before,
*::after {