Skip to content

feat(DarkTheme): Dark theme via CSS-variable token engine - #4054

Draft
m7kvqbe1 wants to merge 11 commits into
masterfrom
feat/dark-mode-token-set
Draft

feat(DarkTheme): Dark theme via CSS-variable token engine#4054
m7kvqbe1 wants to merge 11 commits into
masterfrom
feat/dark-mode-token-set

Conversation

@m7kvqbe1

@m7kvqbe1 m7kvqbe1 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Related issue

N/A — exploratory spike / draft.

Overview

Adds a working dark theme to the design system. A CSS‑variable token engine themes the whole library (including content rendered through portals) with no per‑component edits, backed by a genuine dark colour token set, a Storybook Light/Dark toggle, and per‑component contrast/polish tuning. Light mode is unchanged.

Link to preview

Storybook: toggle the paintbrush (Light/Dark) on any story.

Reason

Evaluate a dark theme for RNDS that can be toggled alongside light, with great contrast and no regressions to the existing light theme.

Work carried out

  • CSS‑variable token engine — color() emits var(--color-<group>-<weight>, <lightFallback>); GlobalStyleProvider injects the active theme's --color-* at :root (so portals theme too)
  • colorValue() for fixed/foreground colours; colorByMode(group, lightShade, darkShade) so dark tweaks never touch light
  • Genuine dark colour token set (tokens/dark/colors.json)
  • Storybook Light/Dark toolbar toggle + themed docs container
  • Per‑component contrast & polish (buttons, sidebar, badges, tooltip, data grid, modal, pagination, progress bar, classification bar, notifications, date picker, …)
  • Light theme verified pixel‑identical to before (dark‑only changes via colorByMode)
  • Visual/snapshot baselines, formal a11y pass, design sign‑off (spike — not done)

Screenshot

To add: Storybook Button/DataGrid/Modal in Light vs Dark.

Developer notes

  • Behaviour change: color() now returns var(--color-…, <hex>) instead of a raw hex when no theme is threaded. Anything asserting a raw hex, or feeding color() into polished, should use the new colorValue(). In‑repo cases are already converted.
  • Always‑dark surfaces (sidebar, tooltip) and on‑colour text are frozen via colorValue; theme‑specific shades use colorByMode.
  • Companion preview PR (portal): https://github.com/defencedigital/dna-mddb-portal/pull/481
  • Draft / spike — not intended for merge as‑is.

@m7kvqbe1 m7kvqbe1 changed the title feat(DarkTheme): Dark theme via CSS-variable token engine [spike] feat(DarkTheme): Dark theme via CSS-variable token engine Jun 25, 2026
@m7kvqbe1
m7kvqbe1 force-pushed the feat/dark-mode-token-set branch 3 times, most recently from 383c363 to f595ea2 Compare June 29, 2026 21:15
@chromatic-com

chromatic-com Bot commented Jun 29, 2026

Copy link
Copy Markdown

Important

Testing in progress…

🟢 UI Tests: 254 tests unchanged
UI Review: Comparing 254 stories…
Storybook icon Storybook Publish: 254 stories published

@chromatic-com

chromatic-com Bot commented Jun 29, 2026

Copy link
Copy Markdown

Tip

All tests passed and all changes approved!

🟢 UI Tests: 254 tests unchanged
🟢 UI Review: 254 stories published -- no changes
Storybook icon Storybook Publish: 254 stories published

@m7kvqbe1
m7kvqbe1 force-pushed the feat/dark-mode-token-set branch from f595ea2 to 1d2e66c Compare June 30, 2026 09:06
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
58.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant