Thema-fundament: variant (B/E) x modus (licht/donker), tijdreis-knop en overgang
Vervangt rood/paars door tokens per variant en modus, voegt ModeToggle en icoon-knop VariantToggle toe, VariantRenderer met lazy E-chunk, dither-overgang (uit bij minder beweging), theme-init.js tegen themaflits en tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+126
-34
@@ -2,36 +2,73 @@
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
/* Theme tokens — values ported 1-to-1 from References/slp-software-rood.html (red, default)
|
||||
and References/slp-software.html (purple, alternate). See
|
||||
aidlc-docs/features/react-frontend/construction/react-frontend-app/functional-design/domain-entities.md
|
||||
(ThemeTokens) for the data model these mirror. */
|
||||
.theme-red {
|
||||
--color-bg: #140c0e;
|
||||
--color-surface: #1f1315;
|
||||
--color-surface-2: #291719;
|
||||
--color-line: #402226;
|
||||
--color-text: #f5eaeb;
|
||||
--color-muted: #b69c9f;
|
||||
--color-accent: #e04848;
|
||||
--color-accent-soft: rgba(224, 72, 72, 0.16);
|
||||
--color-accent-line: rgba(224, 72, 72, 0.4);
|
||||
--color-accent-hover: #ea6161;
|
||||
--color-accent-contrast: #140c0e;
|
||||
/* Theme tokens: variant (b | e) x mode (light | dark), selected by <html data-variant data-mode>
|
||||
(set before first paint by public/theme-init.js and kept in sync by ThemeProvider).
|
||||
Semantic names stay the same so the Tailwind colors in tailwind.config.ts keep working.
|
||||
B values follow the canvas design B (accent #7A1414); E values are base tokens, refined per era
|
||||
in unit U5 (accent #AC0000). See
|
||||
aidlc-docs/features/redesign-modern-timetravel/construction/theme-foundation/functional-design/domain-entities.md */
|
||||
|
||||
/* Default (also used when the attributes are missing): B light. */
|
||||
:root,
|
||||
html[data-variant='b'][data-mode='light'] {
|
||||
color-scheme: light;
|
||||
--color-bg: #ffffff;
|
||||
--color-surface: #f1efec;
|
||||
--color-surface-2: #faf8f5;
|
||||
--color-line: #e4e0dc;
|
||||
--color-text: #0e0d0d;
|
||||
--color-muted: #5c5753;
|
||||
--color-accent: #7a1414;
|
||||
--color-accent-soft: rgba(122, 20, 20, 0.1);
|
||||
--color-accent-line: rgba(122, 20, 20, 0.35);
|
||||
--color-accent-hover: #911a1a;
|
||||
--color-accent-contrast: #ffffff;
|
||||
}
|
||||
|
||||
.theme-purple {
|
||||
--color-bg: #0e1220;
|
||||
--color-surface: #151a2c;
|
||||
--color-surface-2: #1b2138;
|
||||
--color-line: #262e4a;
|
||||
--color-text: #e9ebf5;
|
||||
--color-muted: #98a0ba;
|
||||
--color-accent: #8b7cff;
|
||||
--color-accent-soft: rgba(139, 124, 255, 0.14);
|
||||
--color-accent-line: rgba(139, 124, 255, 0.35);
|
||||
--color-accent-hover: #9d90ff;
|
||||
--color-accent-contrast: #0e1220;
|
||||
html[data-variant='b'][data-mode='dark'] {
|
||||
color-scheme: dark;
|
||||
--color-bg: #0f0e0e;
|
||||
--color-surface: #181615;
|
||||
--color-surface-2: #232020;
|
||||
--color-line: #3a3532;
|
||||
--color-text: #f3f0ec;
|
||||
--color-muted: #b3ada7;
|
||||
--color-accent: #e5524a;
|
||||
--color-accent-soft: rgba(229, 82, 74, 0.16);
|
||||
--color-accent-line: rgba(229, 82, 74, 0.4);
|
||||
--color-accent-hover: #ec6a62;
|
||||
--color-accent-contrast: #0f0e0e;
|
||||
}
|
||||
|
||||
html[data-variant='e'][data-mode='light'] {
|
||||
color-scheme: light;
|
||||
--color-bg: #ffffff;
|
||||
--color-surface: #f3f3f3;
|
||||
--color-surface-2: #e9e9e9;
|
||||
--color-line: #d0d0d0;
|
||||
--color-text: #1a1a1a;
|
||||
--color-muted: #555555;
|
||||
--color-accent: #ac0000;
|
||||
--color-accent-soft: rgba(172, 0, 0, 0.1);
|
||||
--color-accent-line: rgba(172, 0, 0, 0.35);
|
||||
--color-accent-hover: #c40000;
|
||||
--color-accent-contrast: #ffffff;
|
||||
}
|
||||
|
||||
html[data-variant='e'][data-mode='dark'] {
|
||||
color-scheme: dark;
|
||||
--color-bg: #1b1b1d;
|
||||
--color-surface: #232326;
|
||||
--color-surface-2: #2c2c30;
|
||||
--color-line: #3d3d42;
|
||||
--color-text: #ededed;
|
||||
--color-muted: #a8a8ad;
|
||||
--color-accent: #ff6b5e;
|
||||
--color-accent-soft: rgba(255, 107, 94, 0.16);
|
||||
--color-accent-line: rgba(255, 107, 94, 0.4);
|
||||
--color-accent-hover: #ff8277;
|
||||
--color-accent-contrast: #1b1b1d;
|
||||
}
|
||||
|
||||
html {
|
||||
@@ -49,15 +86,15 @@ body {
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
/* Instant, non-animated theme switch when the visitor prefers reduced motion (BR-5). */
|
||||
.theme-red,
|
||||
.theme-purple {
|
||||
transition: background-color 0.2s ease, color 0.2s ease;
|
||||
/* Smooth colour change on mode switch; instant for visitors who prefer reduced motion (BR-U1-9). */
|
||||
html {
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
color 0.2s ease;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.theme-red,
|
||||
.theme-purple {
|
||||
html {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@@ -82,3 +119,58 @@ body {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Time-travel transition between variants (BR-U1-6): a pixel-dither overlay that covers the page
|
||||
(phase "cover"), stays while the variant swaps, then clears (phase "reveal"). Not rendered at all
|
||||
under prefers-reduced-motion (see TransitionOverlay) and hidden here as a safety net. */
|
||||
@keyframes tt-dither-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes tt-dither-out {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tt-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100;
|
||||
pointer-events: all;
|
||||
background-color: var(--color-accent);
|
||||
background-image: conic-gradient(
|
||||
var(--color-bg) 25%,
|
||||
transparent 0 50%,
|
||||
var(--color-bg) 0 75%,
|
||||
transparent 0
|
||||
);
|
||||
background-size: 8px 8px;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
.tt-overlay[data-phase='cover'] {
|
||||
animation: tt-dither-in 300ms steps(6) forwards;
|
||||
}
|
||||
|
||||
.tt-overlay[data-phase='swap'] {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tt-overlay[data-phase='reveal'] {
|
||||
animation: tt-dither-out 300ms steps(6) forwards;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.tt-overlay {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user