Skip to content

Merge base-display and base scales#1390

Open
lukasoppermann wants to merge 37 commits into
mainfrom
merge-34-56-test
Open

Merge base-display and base scales#1390
lukasoppermann wants to merge 37 commits into
mainfrom
merge-34-56-test

Conversation

@lukasoppermann

Copy link
Copy Markdown
Collaborator

This pull request makes significant updates to the color system, including expanding the display color scale, adding new hues, calibrating for high-contrast accessibility, and updating documentation and Storybook stories to reflect these changes. The updates are comprehensive and introduce breaking changes to how color scales are referenced and displayed.

Copilot AI review requested due to automatic review settings May 12, 2026 12:14
@lukasoppermann
lukasoppermann requested a review from a team as a code owner May 12, 2026 12:14
@lukasoppermann
lukasoppermann requested a review from TylerJDev May 12, 2026 12:14
@changeset-bot

changeset-bot Bot commented May 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0966a86

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

This PR includes changesets to release 1 package
Name Type
@primer/primitives 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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@github-actions

github-actions Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Design Token Diff (Figma)

The message is too long to be displayed here. For more details, please check the job summary.

lukasoppermann and others added 14 commits May 14, 2026 08:11
- Remove merged indices 4 and 6 from base color scales (light/dark)
- Renumber neutral scale from 0-13 to 0-11
- Update all functional token references (bgColor, borderColor, control, fgColor, syntax)
- Update all component token references
- Validate with contrast check: 2676 checks pass, 0 failures

Mapping:
- Old 0-3 stay at 0-3
- Old 5 → New 4
- Old 7-13 → New 5-11

This maintains WCAG contrast compliance while reducing scale granularity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rate step-7 to step-6

- Smooth dark/dark-dimmed neutral scale hue oscillation (steps 4,6,7,8,9)
- Fix dark-dimmed neutral step 10 saturation spike (explicit #D8DFE6)
- Darken dark/dark-dimmed blue scale steps 0,1,10,11
- Fix light mode hue scale step-0 pure whites (all 8 hue scales tinted)
- Fix all 42 WCAG contrast failures:
  - bgColor-*-emphasis (attention,severe,danger,done,sponsors,upsell,closed): step 7 → step 6 in dark/dark-dimmed/dark-tritanopia/dark-colorblind
  - button-danger HC themes: swap fgColor-rest and bgColor-hover step assignments
- Migrate borderColor-*-emphasis to match bgColor-*-emphasis (step 6 in dark themes)
…dd 11 new hues

- Merge display-dark.json5 and display-light.json5 into dark.json5 and
  light.json5 respectively; remove the now-redundant display-*.json5 files
- Add 11 new hues to all base color scales (light, dark, light HC, dark HC):
  auburn, brown, lemon, olive, lime, pine, teal, cyan, indigo, plum, coral
- Calibrate light high-contrast scale steps 0–2 to CR targets 1.01/1.10/1.20
  vs white for all 19 hues, ensuring smooth visual progression
- Calibrate light HC steps 3–11 to a consistent CR profile across all hues
  (CR targets: s3=1.54, s4=2.21, s5=3.36, s6=5.12, s7=8.09, s8=10.19,
  s9=12.47, s10=14.54, s11=16.86)
…base.color refs

- Replace base.display.color.* references with base.color.* across all hues
- Add light-high-contrast fgColor overrides to step 8 (was step 11) for all
  hues, providing colored text instead of near-black in light HC mode
- Add light-high-contrast bgColor.hover and bgColor.active overrides to step 2
  to ensure sufficient contrast against step 8 foreground (all hues ≥4.5:1)
- Add dark-high-contrast bgColor overrides for all newly added hues
- borderColor aliases fgColor.rest, inheriting HC overrides automatically
display.json5:
- Add all 11 new hues (auburn, brown, lemon, olive, lime, pine, teal, cyan,
  indigo, plum, coral) with bgColor, fgColor, borderColor, and scale tokens
- Remap scale from steps 0–9 (base.color.*.2–11) to steps 0–11 (base.color.*.0–11)
  so scale indices directly correspond to base color indices; steps 0–1 were
  previously inaccessible via the scale
- Add light-high-contrast overrides for fgColor (step 8) and
  bgColor.emphasis (step 9) to all 19 hues

data-vis.json5:
- Add all 11 new hues with color-emphasis and color-muted tokens
- Migrate base references to base.color.* (from base.display.color.*)
…or new hues

themes.config.ts:
- Register all 11 new hues so they are included in all 13 build themes

colorContrast.config.ts:
- Add contrast check rules for all 11 new hues across light, dark, and
  high-contrast themes

adr-012-color-scale-contrast-map.md:
- Document the CR calibration methodology for light HC steps 0–11
- Record the final per-step CR targets and rationale for step 2 ceiling (1.20)
  to ensure display fgColor at step 8 maintains ≥7:1 in all hue combinations
… up legacy stories

New stories under Color/Display/:
- DisplayColors: Emphasis, Emphasis+border, Muted, Muted+border, and side-by-side
  combination rows for all 19 display hues; 8px border radius
- LabelColors: Interactive Default and With-border rows using label.* tokens;
  hover/active states applied on mouse events (no static state rows)
- Scales: ColorScaleByName blocks for all 19 hues, steps 0–11

Reorganised Color/DataVis (DataWithColors.stories.tsx, titled Color/DataVis):
- LineChart and AreaChart using data-{color}-color-emphasis/muted tokens
- DataVisAccentColors and DataVisMutedColors token tables (moved from Charts.stories.tsx)
- Foreground, Background, and Border token tables for display tokens

Cleanup:
- Remove Color/DataVis/Charts.stories.tsx (content moved to DataWithColors)
- Remove Color/Base/Display-Scales.stories.tsx (superseded by Color/Display/Scales)
- Remove Demo/DisplayColorTesting.stories.tsx (superseded by Color/Display/*)
- Retitle Color/Alpha/Display → Color/Display (Legacy) to avoid sidebar conflict
- Retitle Color/Base/Scales → Base Scales (top-level sidebar group)
Finalize deletion of two story files that were emptied then removed from disk:
- Color/Base/Display-Scales.stories.tsx (superseded by Color/Display/Scales)
- Color/DataVis/Charts.stories.tsx (content moved to Color/Display/DataWithColors)
…s black

All base color steps in dark high-contrast now follow a consistent
contrast ratio progression (1.22→1.67→2.73→3.61→4.70→6.03→7.35→8.46→9.68→11.89→14.11→16.35)
against the dark background (#010409).

Previously broken hues:
- blue: steps 1–4 were identical (all 2.73:1, no differentiation)
- indigo: steps 2–3 nearly identical (2.38/2.40:1), steps 0–4 too compressed
- cyan: steps 3–4 too close (6.0/6.8:1), steps 7–8 identical (10.1/10.1:1)
- gray: steps 7–8 identical (10.8/10.8:1)
- plum: uneven spacing in mid-range

All hues now calibrated using red as the reference profile: H/S per step
preserved, L adjusted via binary search to match red's luminance targets.
…ccess tokens

All 4 failures were introduced by calibrating dark HC base color steps
to red's luminance profile, which moved mid-range steps from dark to
medium-brightness, breaking fg/bg pair relationships.

Fixes:
- display-blue-bgColor-emphasis: blue.4 -> blue.2 in all dark HC variants
  (all other hues already used step 2; blue used step 4 only because
  old uncalibrated steps 1-4 were all identical, accidentally passing)
- fgColor-success (colorblind/tritanopia HC): blue.8 -> blue.9
  (blue.8 got dimmer, blue.5 muted bg got brighter = less contrast)
- fgColor-attention (dark HC variants): add yellow.9 override
  (no dark HC override existed; inherited yellow.8 which got dimmer)
- fgColor-severe (dark HC): orange.8 -> orange.9, red.8 -> red.9
  (tritanopia uses red for severe; both got dimmer from calibration)
lukasoppermann and others added 6 commits May 15, 2026 12:06
…ation

- Darken blue steps 6-9 in dark theme (aligned to cyan contrast profile)
- Apply matching adjustments to soft-dark theme
- Document all removed tokens from display scale consolidation (193 mappings)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
#1393)

* Update storybook structure

* updates\

* github-actions[bot] Regenerated snapshots

---------

Co-authored-by: lukasoppermann <813754+lukasoppermann@users.noreply.github.com>
* perf: consolidate VRT color snapshots to reduce test count

Remove nested loop in e2e/storybook.test.ts that was creating 1,400+ individual color swatch tests (one per color token × theme combination). This was causing VRT to take 30-35 minutes.

Instead, rely on the existing AllColorsTable.stories.tsx which captures all color tokens in a single consolidated snapshot per theme (~42 tests instead of 1,400+).

Expected impact: VRT runtime reduced to ~5-7 minutes across 5 shards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add bgColor all-themes VRT story

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Include bgColor themes in snapshots

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add red outline in bgColor VRT

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revert "Add red outline in bgColor VRT"

This reverts commit 8e898a0.

* github-actions[bot] Regenerated snapshots

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: lukasoppermann <813754+lukasoppermann@users.noreply.github.com>
* testing vrt

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Reduce VRT shards to 3

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Use light snapshots for bgColor VRT

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add missing VRT color tables

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* reset tokens

* Split oversized VRT stories

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Increase Playwright timeout for VRT

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* github-actions[bot] Regenerated snapshots

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: lukasoppermann <813754+lukasoppermann@users.noreply.github.com>
* Split VRT stories further

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Reuse VRT build assets

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revert shared VRT prep

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* perf: balance VRT shard distribution by reordering tests

Reorder tests so heavy stories (all-theme, 14 tests) and light stories (single-theme, 1 test) are interleaved. This ensures Playwright's sequential shard division results in more balanced test counts across shards.

Before: Shard 1: 48 tests, Shard 2: 23 tests, Shard 3: 0 tests
After: Each shard gets ~24 tests by distributing heavy and light stories evenly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: add new z-index token (untested)

Add z-index-700 token to verify VRT workflows run without color token changes.
This token is not tested in VRT snapshots, allowing us to validate workflow
performance improvements without snapshot regression concerns.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: preserve snapshot names while reordering tests for shard balance

Revert to nested test.describe blocks to maintain existing snapshot names while keeping
the reordering logic. Stories are now sorted by weight (heavy first) before iteration,
ensuring Playwright's sequential shard division produces balanced test counts.

Fixes snapshot mismatch failures from flattened test names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* github-actions[bot] Regenerated snapshots

* revert: remove test z-index token

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: lukasoppermann <813754+lukasoppermann@users.noreply.github.com>
* Fix VRT hex text color in dark mode

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Refine VRT table coverage and layout

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* github-actions[bot] Regenerated snapshots

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: lukasoppermann <813754+lukasoppermann@users.noreply.github.com>
@github-actions
github-actions Bot temporarily deployed to Preview (Storybook) June 15, 2026 07:37 Inactive
@github-actions
github-actions Bot temporarily deployed to Preview (Storybook) June 22, 2026 09:15 Inactive
@lukasoppermann lukasoppermann added update snapshots Update visual regression test snapshots and removed update snapshots Update visual regression test snapshots labels Jun 22, 2026
@github-actions
github-actions Bot temporarily deployed to Preview (Storybook) June 22, 2026 14:37 Inactive
@github-actions github-actions Bot removed the update snapshots Update visual regression test snapshots label Jun 22, 2026
@primer
primer Bot temporarily deployed to github-pages June 22, 2026 14:40 Inactive
@github-actions
github-actions Bot temporarily deployed to Preview (Storybook) June 22, 2026 14:41 Inactive
@github-actions
github-actions Bot temporarily deployed to Preview (Storybook) June 22, 2026 16:17 Inactive
@lukasoppermann lukasoppermann added the update snapshots Update visual regression test snapshots label Jun 22, 2026
@github-actions github-actions Bot removed the update snapshots Update visual regression test snapshots label Jun 22, 2026
@primer
primer Bot temporarily deployed to github-pages June 22, 2026 23:36 Inactive
@github-actions
github-actions Bot temporarily deployed to Preview (Storybook) June 22, 2026 23:36 Inactive
@TylerJDev

Copy link
Copy Markdown
Member

Hey @lukasoppermann! 👋

I was reviewing this PR and realized it might be good for another designer (or design engineer) to also look at these changes. Also, is there a place where we can see the changes in preview, or is Storybook the only place to view them?

@jonrohan jonrohan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should leave this open while we test these new colors under the primer_primitives_experimental flag

sneharao3 and others added 3 commits July 7, 2026 12:38
* Repoint HC foreground neutrals to neutral.10

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Set underlineNav HC icon color to neutral.8

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Tune dark HC icon tokens for contrast

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Tune dark HC muted token mappings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Tune dark HC component fg tokens

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Tune dark HC keybinding hint fg

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Tune HC fgColor closed and muted

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…es (#1405)

* Adjust color and shadow token tuning

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Tune color scale tokens

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Set default muted/neutral to neutral.9

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Set dark fgColor.onEmphasis to white for emphasis contrast

* Darken bgColor.neutral.emphasis so white text passes contrast in light themes

* Fix control-borderColor-emphasis contrast in default themes

* Set danger/primary button text to white for contrast in dark themes

* Update button.json5 to use fgColor instead of base.color

Use fgColor.white on line 247

---------

Co-authored-by: Lukas Oppermann <lukasoppermann@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
github-actions Bot temporarily deployed to Preview (Storybook) July 7, 2026 19:41 Inactive
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

5 participants