Skip to content

feat: dark mode colour scheme support - #3514

Merged
chdefrene merged 15 commits into
mainfrom
chdefrene/dark-mode-color-scheme
Dec 3, 2026
Merged

chdefrene merged 15 commits into
mainfrom
chdefrene/dark-mode-color-scheme

Conversation

@chdefrene

@chdefrene chdefrene commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

🤖 Drafted by GitHub Copilot (Copilot CLI) · Claude Opus 5.5

TL;DR: React components follow the host's light or dark colour scheme. They use EDS CSS colour variables instead of the JS tokens object and hard-coded colours. @equinor/fusion-react-styles maps the classic EDS 2.x variables to --eds-color-* in dark mode, and the temporary forced light mode is removed.

The shared dark canvas, panel and raised surfaces use EDS CSS variables only; explicit Light keeps stock EDS colours. The committed lockfile uses stable Web Components releases from public npm.

Component Development

Type

  • Feature
  • Fix
  • Hotfix (should release ASAP)
  • Maintenance (deps only)

Reference to assignment

Refs https://github.com/equinor/fusion-core-tasks/discussions/2755 ("Dark mode support across Fusion"). This is the fusion-react-components part. Release order: fusion-web-components → fusion-react-components → fusion-framework → fusion-portal and fusion-core-apps. No issues close on merge.

Part of equinor/fusion-core-tasks#3135 (feature equinor/fusion-core-tasks#3133).

Description of assignment

Fusion components must follow the colour scheme the portal sets: Light, Dark or System. They used the JS tokens object from @equinor/eds-tokens, hard-coded colours and a temporary forced light mode in @equinor/fusion-react-styles, none of which react to the scheme.

Description of Proposed Changes

  1. Use EDS CSS colour variables. Replaces the JS tokens object, hard-coded colours and legacy fallback colours with var(--eds-color-*) from eds-tokens 2.3.2, with no literal fallbacks. Also updates the docs, skills and examples, adds MDC overrides for fwc-select, the context selector and the searchable dropdown, and uses --eds-color-bg-neutral-canvas as the Storybook page background. The side sheet Indicator now accepts an EDS CSS variable (IndicatorColor), not only hex.

  2. Map classic EDS colour variables to the colour scheme. EDS 2.x classic components read var(--eds_*, <light fallback>). In dark mode only, @equinor/fusion-react-styles maps these variables to --eds-color-* at the root, so stable classic components such as Scrim, Tooltip, Snackbar and Button follow the scheme. It exports classicColourVariables, classicScrimColour, classicOverlayColour, classicOverlayColours, classicOverlayTextStyles, classicColourDeclarations and classicColourSchemeStyles. The scrim stays translucent and the tooltip and Snackbar overlays use light text on a dark background. This commit also enables jsdom for the styles tests and aliases styled-components to its browser build, so the existing styles suite runs.

  3. Remove temporary forced light mode. Removes the forced light scheme from @equinor/fusion-react-styles and Storybook.

  4. Support light and dark colour schemes. Adds a colorScheme prop to ThemeProvider:

    • omitted: inherits the scheme from data-color-scheme or color-scheme on an ancestor;
    • light / dark: forces that scheme;
    • system: resolves prefers-color-scheme and sets an explicit value.

    Also adds the Storybook Light/Dark/System toolbar, which always sets an explicit data-color-scheme, plus contrast tests and README docs.

  5. Use published Fusion Web Components releases. Points packages at the web-components versions from feat: dark mode support with EDS CSS colour variables and fwc-theme colour schemes fusion-web-components#2551 and adds changesets for the affected wrappers.

  6. Restore inheritance when the scheme is cleared. ThemeProvider sets only color-scheme; <fwc-theme> 2 resolves the scheme and manages data-color-scheme.

  7. Release the stylesheet requirement as a breaking change. Standalone components that lost their fallback colours receive major bumps, so consumers don't pick up the new EDS stylesheet requirement through a patch or minor upgrade.

  8. Share Fusion dark surface colours. Extend the existing theme helpers so classic React and fwc-theme inherit the same dark palette. Use --eds-color-bg-neutral-canvas for page backgrounds, --eds-color-bg-neutral-surface for panels and headers, --eds-color-bg-floating for raised cards, and --eds-color-text-neutral-strong for primary text. Dark link and focus colours also use EDS variables to stay visible on the raised surface.

  9. Match native controls to the OS scheme. With no explicit setting, OS Dark also sets color-scheme: dark; explicit Light still wins. The styles package tolerates CSS import stubs in downstream tests, and custom hosts are directed to the helper that resets legacy mappings in nested Light scopes.

How consumers get the scheme: set data-color-scheme="light|dark" on <html> (resolve System with matchMedia) and load the EDS tokens CSS, for example through ThemeProvider. Content portaled to document.body only follows the scheme on <html> or <body>.

fusion-wc versions from equinor/fusion-web-components#2551, now available on public npm:

Package From To
@equinor/fusion-wc-theme 1.2.6 ^2.0.0
@equinor/fusion-wc-avatar 3.3.5 ^4.0.0
@equinor/fusion-wc-chip 1.3.5 ^2.0.0
@equinor/fusion-wc-list 1.2.5 ^2.0.0
@equinor/fusion-wc-markdown 1.6.5 ^2.0.0
@equinor/fusion-wc-page 0.2.1 ^1.0.0
@equinor/fusion-wc-people 2.2.6 ^3.0.0
@equinor/fusion-wc-person 3.5.7 ^4.0.0
@equinor/fusion-wc-searchable-dropdown 4.1.5 ^5.0.0
@equinor/fusion-wc-skeleton 2.2.5 ^3.0.0
@equinor/fusion-wc-textarea 1.2.4 ^2.0.0

The following stay unchanged because they have no major bump and depend on no bumped package:

  • fusion-wc-ripple (patch only, still in ^1.2.4);
  • fusion-wc-icon, fusion-wc-date and fusion-wc-layout (no changeset).

@equinor/fusion-react-date therefore needs no change. Every direct wc range matches the new majors, and the web-components changesets update their internal ranges, so no custom element is registered twice.

Public dependency update: Commit ef56ad9c regenerates bun.lock with Bun 1.4.5 against public npm. The lockfile resolves the published Web Components versions and contains no Verdaccio references. The temporary Verdaccio tooling and contributor instructions were removed; existing local previews are unaffected.

Versions these changesets will produce (bun run changeset status --output=/dev/stdout):

  • Major (adopt web-component majors or remove standalone colour fallbacks; the host must load the @equinor/eds-tokens 2.x CSS):
    • @equinor/fusion-react-styles 3.0.0 (also: ThemeProvider and <fwc-theme> no longer force light mode)
    • @equinor/fusion-react-person 3.0.0
    • @equinor/fusion-react-context-selector 3.0.0
    • @equinor/fusion-react-searchable-dropdown 3.0.0
    • @equinor/fusion-react-filter 3.0.0
    • @equinor/fusion-react-markdown 2.0.0
    • @equinor/fusion-react-skeleton 2.0.0
    • @equinor/fusion-react-list 2.0.0
    • @equinor/fusion-react-textarea 2.0.0
    • @equinor/fusion-react-layout 1.0.0
    • @equinor/fusion-react-ag-grid-person-cell 6.0.0 (gets fusion-wc-person 4 through fusion-react-person)
    • @equinor/fusion-react-components 2.0.0 (re-exports fusion-react-person)
    • @equinor/fusion-react-side-sheet 3.0.0 (IndicatorColor and stylesheet requirement)
    • @equinor/fusion-react-ag-grid-utils 34.0.0
    • @equinor/fusion-react-errorboundary 3.0.0 and @equinor/fusion-react-hanging-garden 3.0.0
    • @equinor/fusion-react-stepper 4.0.0
    • @equinor/fusion-react-tabs 3.0.0
  • Minor:
    • @equinor/fusion-web-theme 0.2.0

Validation:

  • On d7442987, bun install --frozen-lockfile --registry=https://registry.npmjs.org, bun run check, biome ci, bun run build, and bun run test passed (97 tests).
  • Chromium: Verified System, explicit Light, nested Dark and inherited <fwc-theme>. The three dark fills match the approved targets within two RGB levels per channel; Light is unchanged. The raised surface has 9.21:1 primary text contrast, 5.49:1 link contrast and 4.49:1 focus contrast.
  • Review regression: With fwc-theme 2.0.0, the scheme-reset test failed before the fix and passed afterward.
  • Public CI: Biome and CodeQL passed at ef56ad9c. Chromatic was skipped.

Open questions and risks:

  • Semver: wrappers that move to a new @equinor/fusion-wc-* major (or re-export one) and standalone packages that remove colour fallbacks get a major bump. The host must load the @equinor/eds-tokens CSS.
  • Classic overlays: the classic → EDS mapping covers the variables that classic EDS 2.x components read. Classic components that set literal colours without a variable stay light in dark mode.
  • Portaled content follows the scheme only when it is set on <html> or <body>. EdsTokens re-declares the EDS semantic aliases on every [data-color-scheme], so a dark <body> under a light <html> resolves dark values.

Checklist

Create User Story(DevOps) or Issue(Github)

  • Describe functional requirements
  • Design plan/suggestion (e.g. images, link to eds design or relevant figma links, mention of eds tokens to use)
  • Communication with UX (evaluate if needed)

Development

  • Describe the component
  • Code funtional requirements
  • Create stories
  • Create snapshots (evaluate if needed)
  • Remove unused imports and commented code
  • Lint code with Biome (and follow best practises for code quality

Create Pull Request

  • Assign relevant reviewers in Github and Cromatic
  • Inform colleagues of pending reviews. We use Teams for this purpose, under fusion-frontend team please tag involved reviewers in the Code review channel

Review of Pull Request

  • Follow up on comments from code review and implement necessary changes (evaluate if needed)
  • Review approved in github (and chromatic)

Publish Code

  • Increment version number
  • Merge PR
  • Consider letting fusion developers know this this shiny new thing exists
Details

Shared dark surfaces before and after (Chromium, left to right: canvas, panel, raised; rows: system dark, explicit light, nested dark; short line = link, outline = focus).

Before After
Stock EDS dark swatches, with an explicit light row Fusion dark swatches with distinct canvas, panel and raised colours; light row unchanged

Native controls and Storybook surface (Chromium):

Before After
Before: light native controls and a panel that blends into the dark canvas After: dark native controls and a distinct panel surface

EDS Snackbar contrast (Chromium):

Before After
Dark Snackbar before: text at 1.32:1 contrast Dark Snackbar after: text at 15.18:1 contrast

Light and dark mode: checked manually in Storybook and in the portal through local package links. Stories cover the Light/Dark/System toolbar, side sheet and scrim, tooltip and snackbar contrast, fwc-select and the context selector.

Selected files changed:

  • .changeset/ag-grid-person-cell-wc-person-major.md
  • .changeset/classic-eds-dark-mapping.md
  • .changeset/dark-mode-component-colours.md
  • .changeset/dark-mode-react-styles.md
  • .changeset/dark-mode-web-theme.md
  • .changeset/mdc-colour-overrides.md
  • .changeset/side-sheet-indicator-colour.md
  • .changeset/unreleased-fusion-wc-majors.md
  • CONTRIBUTING.md
  • bun.lock
  • packages/ag-grid-utils/src/changeHandlerUtils/StatusIcon.tsx
  • packages/context-selector/package.json
  • packages/errorboundary/src/legacy/Fallback.tsx
  • packages/filter/package.json
  • packages/filter/src/components/filter/FilterOptionHeader.tsx
  • packages/filter/src/components/filter/checkbox/CheckboxFilter.style.ts
  • packages/filter/src/components/filter/checkbox/CheckboxFilterOption.style.ts
  • packages/filter/src/components/panel/FilterPanel.tsx
  • packages/hanging-garden/src/components/PopoverContainer/Arrow.tsx
  • packages/hanging-garden/src/components/PopoverContainer/index.tsx
  • packages/layout/package.json
  • packages/list/package.json
  • packages/markdown/package.json
  • packages/person/package.json
  • packages/searchable-dropdown/package.json
  • packages/searchable-dropdown/src/Dropdown.tsx
  • packages/searchable-dropdown/src/colour-overrides.ts
  • packages/searchable-dropdown/tsconfig.json
  • packages/side-sheet/README.md
  • packages/side-sheet/src/components/Indicator.tsx
  • packages/side-sheet/src/components/SideSheet.tsx
  • packages/side-sheet/src/index.ts
  • packages/skeleton/package.json
  • packages/stepper/src/Step.tsx
  • packages/stepper/src/StepBadge.tsx
  • packages/stepper/src/StepperContent.tsx
  • packages/styles/README.md
  • packages/styles/package.json
  • packages/styles/src/EdsTokens.tsx
  • packages/styles/src/ThemeProvider.tsx
  • packages/styles/src/__tests__/ThemeProvider.test.tsx
  • packages/styles/src/__tests__/classic-colours.test.tsx
  • packages/styles/src/classic-colours.ts
  • packages/styles/src/index.ts
  • packages/styles/vitest.config.ts
  • packages/tabs/src/components/Tabs.tsx
  • packages/textarea/package.json
  • packages/theme/README.md
  • packages/theme/src/styles/colors.ts
  • packages/theme/src/styles/index.ts
  • packages/theme/src/styles/mdc.ts
  • packages/theme/src/styles/typography.ts
  • packages/theme/tests/__snapshots__/colors.test.ts.snap
  • packages/theme/tests/colors.test.ts
  • packages/theme/tests/mdc.test.ts
  • storybook/.storybook/color-scheme.test.ts
  • storybook/.storybook/color-scheme.ts
  • storybook/.storybook/light-mode.test.ts
  • storybook/.storybook/preview-head.html
  • storybook/.storybook/preview.tsx
  • storybook/package.json
  • storybook/src/stories/sidesheet/side-sheet.stories.tsx
  • packages/styles/src/color-scheme-aliases.ts
  • packages/styles/src/__tests__/color-scheme-aliases.test.tsx
References and evidence

@chdefrene chdefrene self-assigned this Nov 16, 2026
@changeset-bot

changeset-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a0a76e4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@equinor/fusion-react-styles Major
@equinor/fusion-react-tabs Major
@equinor/fusion-react-stepper Major
@equinor/fusion-react-errorboundary Major
@equinor/fusion-react-ag-grid-utils Major
@equinor/fusion-react-filter Major
@equinor/fusion-react-hanging-garden Major
@equinor/fusion-web-theme Minor
@equinor/fusion-react-ag-grid-person-cell Major
@equinor/fusion-react-components Major
@equinor/fusion-react-searchable-dropdown Major
@equinor/fusion-react-context-selector Major
@equinor/fusion-react-side-sheet Major
@equinor/fusion-react-person Major
@equinor/fusion-react-markdown Major
@equinor/fusion-react-skeleton Major
@equinor/fusion-react-layout Major
@equinor/fusion-react-textarea Major
@equinor/fusion-react-list Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved issues remove popover shadows, leave dark-body portals using light colors, and prevent consumers from importing the advertised colorSchemeVariables mapping.

3 open issues
What changed in this PR

Adds colour-scheme support to Fusion React components as part of the wider Fusion dark-mode rollout. Components inherit the host scheme, with optional Light, Dark or System selection.

Changes:

  • Replaces static component colours with EDS CSS variables and adds classic EDS and Material colour mappings.
  • Adds ThemeProvider.colorScheme, a Storybook scheme toolbar, regression tests and usage documentation.
  • Updates web-component dependency ranges and release changesets. Final validation remains blocked by the unpublished dependencies noted in the PR.
File Description
storybook/​src/​stories/​sidesheet/​side-sheet.stories.tsx Uses scheme-aware indicator colours.
storybook/​package.json Updates the avatar dependency major.
storybook/​.storybook/​preview.tsx Adds the colour-scheme toolbar and decorator.
storybook/​.storybook/​preview-head.html Replaces forced light mode with themed page colours.
storybook/​.storybook/​light-mode.test.ts Removes obsolete light-only tests.
storybook/​.storybook/​color-scheme.ts Resolves and applies toolbar scheme choices.
storybook/​.storybook/​color-scheme.test.ts Tests scheme switching, inheritance and contrast.
packages/​theme/​tests/​mdc.test.ts Checks Material colour mappings.
packages/​theme/​tests/​colors.test.ts Tests scheme-aware theme output.
packages/​theme/​tests/​__snapshots__/​colors.test.ts.snap Updates expected colour declarations.
packages/​theme/​src/​styles/​typography.ts Maps typography colours to EDS variables.
packages/​theme/​src/​styles/​mdc.ts Defines Material-to-EDS colour mappings.
packages/​theme/​src/​styles/​index.ts Exports Material mapping utilities.
packages/​theme/​src/​styles/​colors.ts Maps legacy colours and removes forced light mode.
packages/​theme/​README.md Documents token loading and scheme inheritance.
packages/​textarea/​package.json Updates the textarea dependency major.
packages/​tabs/​src/​components/​Tabs.tsx Uses a scheme-aware divider colour.
packages/​styles/​vitest.config.ts Enables browser-style injection in tests.
packages/​styles/​src/​ThemeProvider.tsx Adds explicit and system scheme selection.
packages/​styles/​src/​index.ts Exports scheme types and classic mapping helpers.
packages/​styles/​src/​EdsTokens.tsx Injects Material and classic colour mappings.
packages/​styles/​src/​classic-colours.ts Defines classic EDS dark-mode mappings.
packages/​styles/​src/​__tests__/​ThemeProvider.test.tsx Tests provider scheme attributes and updates.
packages/​styles/​src/​__tests__/​classic-colours.test.tsx Tests classic mapping coverage and output.
packages/​styles/​README.md Documents provider schemes and classic overlays.
packages/​styles/​package.json Updates the theme dependency and adds jsdom.
packages/​stepper/​src/​StepperContent.tsx Uses a scheme-aware divider token.
packages/​stepper/​src/​StepBadge.tsx Themes badge states with EDS variables.
packages/​stepper/​src/​Step.tsx Themes step text, connectors and focus styling.
packages/​skeleton/​package.json Updates the skeleton dependency major.
packages/​side-sheet/​src/​index.ts Exports expanded indicator colour types.
packages/​side-sheet/​src/​components/​SideSheet.tsx Themes the surface and widens indicator typing.
packages/​side-sheet/​src/​components/​Indicator.tsx Accepts CSS variables and themes the default colour.
packages/​side-sheet/​README.md Documents CSS-variable indicator colours.
packages/​searchable-dropdown/​tsconfig.json Adds the theme project reference.
packages/​searchable-dropdown/​src/​Dropdown.tsx Applies dropdown colour overrides on import.
packages/​searchable-dropdown/​src/​colour-overrides.ts Injects Material colour overrides for dropdowns.
packages/​searchable-dropdown/​package.json Updates dependencies for themed dropdowns.
packages/​person/​package.json Updates person and people dependency majors.
packages/​markdown/​package.json Updates the markdown dependency major.
packages/​list/​package.json Updates the list dependency major.
packages/​layout/​package.json Updates the page dependency major.
packages/​hanging-garden/​src/​components/​PopoverContainer/​index.tsx Changes popover surface and shadow styling.
packages/​hanging-garden/​src/​components/​PopoverContainer/​Arrow.tsx Themes popover arrow fill and border.
packages/​filter/​src/​components/​panel/​FilterPanel.tsx Themes panel borders and backgrounds.
packages/​filter/​src/​components/​filter/​FilterOptionHeader.tsx Themes header and counter text.
packages/​filter/​src/​components/​filter/​checkbox/​CheckboxFilterOption.style.ts Themes option hover and counter colours.
packages/​filter/​src/​components/​filter/​checkbox/​CheckboxFilter.style.ts Themes checkbox-filter titles.
packages/​filter/​package.json Updates the chip dependency major.
packages/​errorboundary/​src/​legacy/​Fallback.tsx Themes error details and supporting text.
packages/​context-selector/​package.json Updates the dropdown dependency major.
packages/​ag-grid-utils/​src/​changeHandlerUtils/​StatusIcon.tsx Uses semantic EDS status colours.
CONTRIBUTING.md Documents scheme testing and colour conventions.
bun.lock Records test dependencies and initial theme changes.
.changeset/​unreleased-fusion-wc-majors.md Records wrapper majors and migration requirements.
.changeset/​side-sheet-indicator-colour.md Records indicator colour support.
.changeset/​mdc-colour-overrides.md Records Material colour mapping additions.
.changeset/​fusion-wc-person-major-dependants.md Records major releases for person dependants.
.changeset/​dark-mode-web-theme.md Records scheme-aware theme changes.
.changeset/​dark-mode-react-styles.md Records the provider colour-scheme API.
.changeset/​dark-mode-component-colours.md Records component colour migrations.
.changeset/​classic-eds-dark-mapping.md Records classic EDS mappings and exports.

Review effort: Balanced

Comment thread packages/styles/src/EdsTokens.tsx Resolved
Comment thread packages/theme/src/styles/index.ts Resolved
@chdefrene
chdefrene force-pushed the chdefrene/dark-mode-color-scheme branch from aff2a6e to 694bb87 Compare November 27, 2026 21:27
Copilot AI balanced review requested due to automatic review settings November 27, 2026 21:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The theme provider can retain a stale color scheme, and breaking host-stylesheet requirements are incorrectly packaged as minor or patch releases instead of major releases.

3 open issues
3 resolved since last review

Review effort: Balanced

Comment thread packages/styles/src/ThemeProvider.tsx Resolved
Copilot AI balanced review requested due to automatic review settings November 27, 2026 21:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

ThemeProvider’s direct writes to data-color-scheme conflict with the web component’s asynchronous restoration logic, leaving the subtree forced to dark instead of inheriting when colorScheme is removed.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 27, 2026 21:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

An unpublished moderate finding that the snackbar selector misses nested alerts, leaving dark text against a dark overlay, requires human assessment before approval.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 27, 2026 22:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The rollout depends on unpublished fusion-wc majors, so preview evidence cannot establish release compatibility without public-registry installs, a regenerated lockfile, passing CI, and browser validation.

No open issues 🎉

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unpublished upstream Web Component majors block public-registry release validation, leaving the refreshed public lockfile, clean install/build/test results, and real rendering checks pending human confirmation.

No open issues 🎉

Review effort: Balanced

@chdefrene
chdefrene force-pushed the chdefrene/dark-mode-color-scheme branch from 9471ee3 to 617236b Compare December 1, 2026 08:19
Copilot AI balanced review requested due to automatic review settings December 1, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Snackbar selector misses alerts nested inside popover wrappers, leaving dark text on a dark overlay; the selector and tests need updating to cover this structure.

1 open issue

Review effort: Balanced

Comment thread packages/styles/src/classic-colours.ts Resolved
Copilot AI balanced review requested due to automatic review settings December 1, 2026 08:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Global theme overrides have broad cross-package effects that require clean-install and browser validation against final public Web Component artifacts, especially for nested themes, shadow DOM, and body portals, which could not be independently performed.

No open issues 🎉

Review effort: Balanced

@chdefrene
chdefrene requested a review from a team December 1, 2026 13:52

@eikeland eikeland left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Drafted with GitHub Copilot · gemini-4-neon · high reasoning

TL;DR: The dark-mode architecture, <fwc-theme> 2 integration, public npm lockfile, and Changesets bumps are solid. Please address three items before merge—a non-string guard in colourSchemeAliasDeclarations, color-scheme: dark in the OS-dark fallback, and removing the temporary branch-specific preview script and stale CONTRIBUTING.md SHAs.

Summary of findings

Priority Location Finding
Required packages/styles/src/color-scheme-aliases.ts:18-20 Calling source.matchAll at module import time crashes downstream test suites that stub CSS ?raw imports to {} or undefined.
Required packages/styles/src/classic-colours.ts:188-192 OS-dark fallback switches colours to dark while :root keeps color-scheme: light, leaving native controls and scrollbars light.
Required scripts/dark-mode-preview.js & CONTRIBUTING.md:37-65 Branch-specific Verdaccio preview script and stale pre-rebase SHAs are no longer needed now that the web-component majors are published on public npm.
Recommended storybook/.storybook/preview-head.html:4 body uses --eds-color-bg-neutral-surface instead of --eds-color-bg-neutral-canvas, causing panels and SideSheet to blend into the Storybook background in dark mode.
Recommended packages/styles/README.md:367-372 Custom-host snippet omits [data-color-scheme="light"] resets, so nested light subtrees inherit dark --eds_* mappings.

Requested before merge

  • Guard typeof source !== 'string' in colourSchemeAliasDeclarations
  • Add color-scheme: dark; inside @media (prefers-color-scheme: dark) { :root:not([data-color-scheme="light"]) }
  • Remove scripts/dark-mode-preview.js and the branch-specific Local dark-mode preview section in CONTRIBUTING.md (or move generic preview tooling to a follow-up PR)
  • Update the PR description to drop the stale "remains a draft" note and pre-rebase commit SHAs

Validation observed: CI checks (biome, CodeQL, Analyze (javascript)) pass on head ef56ad9c; chromatic-deployment is skipped.

Details: minor follow-ups and non-blocking notes
  • Overlay selector breadth (packages/styles/src/classic-colours.ts:142): [popover] > [role="alert"] matches @equinor/eds-core-react 2.6.2's Snackbar DOM structure, but any non-Snackbar alert rendered directly inside a native [popover] with a classic contained Button will get light button text on a light emphasis fill in dark mode. Worth a brief comment noting the trade-off.
  • Remaining tokens.colors usage (packages/errorboundary/src/legacy/FallbackIcon.tsx): Still reads tokens.colors.infographic.primary__energy_red_55.rgba—looks intentional as a static infographic colour, worth confirming.
  • Link token consistency (packages/theme/src/styles/typography.ts vs packages/styles/src/classic-colours.ts): Paragraph links map to --eds-color-text-accent-subtle in fusion-web-theme and --eds-color-text-link in classic-colours.ts.
References and evidence

Skills: fusion-workbenches, fusion-agent-content

Skill references read:

  • fusion-agent-content/assets/content-skeleton.md.hbs, assets/partials/agent-content/README.md, assets/pre-post-checklist.md: review draft structure and banner metadata rules.

Evidence:

  • @equinor/eds-tokens@2.3.2 (build/css/variables.min.css): confirmed :root, [data-color-scheme=light] sets color-scheme: light and [data-color-scheme=dark] sets color-scheme: dark, while @media (prefers-color-scheme:dark) :root:not([data-color-scheme=light]) omits color-scheme: dark.
  • @equinor/fusion-wc-theme@2.0.0 (equinor/fusion-web-components#2551): confirmed element.css.ts only reads fontFamily from @equinor/fusion-web-theme@^0.1.12, so color-scheme: only light is not re-injected.
  • @equinor/eds-core-react@2.6.2 (Snackbar.js, Snackbar.tokens.js): confirmed Snackbar renders a PopoverDiv wrapping StyledSnackbar[role="alert"] reading --eds_ui_background__overlay and --eds_text__static_icons__primary_white.
  • bun.lock diff on #3514: confirmed all upgraded @equinor/fusion-wc-* packages resolve to public npm releases with no loopback/Verdaccio URLs.

Comment thread packages/styles/src/classic-colours.ts Resolved
Comment thread scripts/dark-mode-preview.js Resolved
Comment thread storybook/.storybook/preview-head.html Resolved
Comment thread packages/styles/README.md Resolved
Comment thread packages/styles/src/classic-colours.ts Resolved
Copilot AI balanced review requested due to automatic review settings December 2, 2026 20:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the colour-scheme support changes.

No open issues 🎉

Review effort: Balanced

@chdefrene
chdefrene requested a review from eikeland December 2, 2026 20:45
chdefrene and others added 15 commits December 3, 2026 14:24
Replace colours from the @equinor/eds-tokens JavaScript `tokens` object and
hard-coded colour literals with EDS colour-scheme-aware CSS custom properties
(`var(--eds-color-…)`, `var(--eds-elevation-low)`), without literal fallbacks.

- Components: ag-grid-utils, errorboundary, filter, hanging-garden,
  side-sheet, stepper and tabs.
- fusion-web-theme maps legacy colour and typography tokens to EDS variables
  (`colorSchemeVariables`).
- The side-sheet Indicator accepts `var(--…)` (`IndicatorColor`) and
  defaults to an EDS danger colour.
- Storybook's preview body uses the EDS neutral surface background
  (`--eds-color-bg-neutral-surface`) and text colour variables.
- Docs and changesets describe the convention.

Ref: equinor/fusion-core-tasks#2755

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Stay on stable @equinor/eds-core-react 2.x and @equinor/eds-tokens 2.3.2.
The classic components read var(--eds_*, <light value>), so the root
ThemeProvider (EdsTokens) now points those properties at the
scheme-aware --eds-color-* variables, only where the tokens select dark
([data-color-scheme="dark"], or the system dark preference on a root
without data-color-scheme="light"). Light mode keeps the classic colours,
and a nested light scheme resets the mapping. Portalled Tooltip, Menu,
Popover, Dialog and Scrim inherit it from the root.

@equinor/fusion-react-styles exports classicColourVariables,
classicScrimColour, classicOverlayColours, classicColourDeclarations()
and classicColourSchemeStyles() for hosts with their own global styles.
The scrim and overlay use a translucent colour-mix of the opaque
--eds-color-bg-backdrop.

Also theme the MWC internals of fwc-select, fwc-searchable-dropdown and
the context selector with EDS colour variables (mdcColorVariables).

Ref: equinor/fusion-core-tasks#2755

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Stop forcing light mode so components follow the EDS colour scheme:
- fusion-web-theme no longer emits `color-scheme: only light`.
- ThemeProvider removes the `data-color-scheme="light"` that fwc-theme
  <= 1.2.6 sets when connected, so the subtree inherits the scheme.
- Storybook's preview head no longer forces `<html data-color-scheme="light">`.
- Docs and tests updated accordingly.

Ref: equinor/fusion-core-tasks#2755

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove the temporary forced light mode and let components follow the colour
scheme the host passes down.

- fusion-react-styles: optional `colorScheme` prop ('light' | 'dark' |
  'system') on ThemeProvider; without it the subtree inherits
  `data-color-scheme` from its ancestors.
- fusion-web-theme: drop the `color-scheme: only light` declaration.
- Storybook: Light/Dark/System toolbar instead of the forced light preview,
  with tests replacing the light-mode check.

Ref: equinor/fusion-core-tasks#2755

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Point @equinor/fusion-wc-theme and the other Fusion web components with
pending colour-scheme majors at the versions their changesets will
produce in equinor/fusion-web-components#2551 (not yet published):

- fusion-wc-theme ^2.0.0
- fusion-wc-avatar ^4.0.0, -chip ^2.0.0, -list ^2.0.0, -markdown ^2.0.0,
  -page ^1.0.0, -people ^3.0.0, -person ^4.0.0,
  -searchable-dropdown ^5.0.0, -skeleton ^3.0.0, -textarea ^2.0.0

bun.lock is unchanged because these versions don't resolve yet; run
`bun install` after they are published.

Ref: equinor/fusion-core-tasks#2755

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
EDS 2.x declares its semantic colour aliases only at the light root, so a
dark subtree under a light root inherited light values. Re-declare the
aliases on every [data-color-scheme] element.

Ref: equinor/fusion-core-tasks#2755

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Ref: equinor/fusion-core-tasks#2755

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@chdefrene
chdefrene enabled auto-merge (squash) December 3, 2026 13:24
@chdefrene
chdefrene force-pushed the chdefrene/dark-mode-color-scheme branch from d744298 to a0a76e4 Compare December 3, 2026 13:30
Copilot AI balanced review requested due to automatic review settings December 3, 2026 13:30
@chdefrene
chdefrene merged commit 0b9fdfb into main Dec 3, 2026
5 checks passed
@chdefrene
chdefrene deleted the chdefrene/dark-mode-color-scheme branch December 3, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Current-step text and descriptions remain low-contrast in dark mode without a ThemeProvider because the current and disabled branches lack scheme-aware text variables.

1 open issue

Review effort: Balanced

: disabled
? 'disabled'
: tokens.colors.text.static_icons__default.hex
isCurrent ? 'primary' : disabled ? 'disabled' : 'var(--eds-color-text-neutral-strong)'
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.

3 participants