You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initial spike exploring how dark mode could work with our V2 token architecture. Adds dark mode to the React PR playground so the team can see how components look and identify gaps.
This is the "CSS override" approach: a hand-authored dark theme file that overrides global and component tokens. It works well as a proof of concept, but the long-term version would involve integrating dark values into Style Dictionary (so they're generated alongside the light tokens), auditing component tokens for hardcoded hex values that break the cascade, and formalizing the surface token system as part of the published design-tokens package.
How to test
npm install (installs @abgov/design-tokens-v2)
npx nx serve react-prs
Click the moon/sun icon at the bottom of the side menu to toggle
Navigate to "Everything" to see all components in dark mode
How it works
surface-tokens.css defines a two-layer elevation system (9 numbered scale tokens + 9 semantic tokens) with light defaults and dark overrides
dark-theme.css overrides ~50 global color primitives + ~40 component tokens. The V2 outputReferences: true cascade handles most components automatically.
dark-mode-overrides.css chains the imports in the right order (V2 tokens, surface tokens, dark theme)
app.tsx adds a toggle in the side menu secondary content and respects system preference on first load
What this is
A spike to validate the approach, not a finished feature. Known gaps are documented. The main question for the team: does this approach feel right for how we'd ship dark mode?
Known gaps
Some components have hardcoded values in shadow DOM that the CSS cascade can't reach (segmented tab indicator, form step hover, native dropdown chevron)
Yes, that's the plan. I added surface tokens that need team review first. The demo version also has dark-mode styles for its custom components that wouldn't apply to other teams, and some component tokens still need to land in design-tokens (feat(#3873): add work-side-menu-account-bg token design-tokens#154).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Initial spike exploring how dark mode could work with our V2 token architecture. Adds dark mode to the React PR playground so the team can see how components look and identify gaps.
This is the "CSS override" approach: a hand-authored dark theme file that overrides global and component tokens. It works well as a proof of concept, but the long-term version would involve integrating dark values into Style Dictionary (so they're generated alongside the light tokens), auditing component tokens for hardcoded hex values that break the cascade, and formalizing the surface token system as part of the published design-tokens package.
How to test
npm install(installs@abgov/design-tokens-v2)npx nx serve react-prsHow it works
surface-tokens.cssdefines a two-layer elevation system (9 numbered scale tokens + 9 semantic tokens) with light defaults and dark overridesdark-theme.cssoverrides ~50 global color primitives + ~40 component tokens. The V2outputReferences: truecascade handles most components automatically.dark-mode-overrides.csschains the imports in the right order (V2 tokens, surface tokens, dark theme)app.tsxadds a toggle in the side menu secondary content and respects system preference on first loadWhat this is
A spike to validate the approach, not a finished feature. Known gaps are documented. The main question for the team: does this approach feel right for how we'd ship dark mode?
Known gaps
textDarktokens serve double duty (text on colored surfaces vs text on page). Needs splitting long-term.Refs #3849