[TEST] Update base and display color scales#1369
[TEST] Update base and display color scales#1369danielguillan wants to merge 11 commits intomainfrom
Conversation
Update semantic/functional token references to darker or lighter scale steps to restore contrast ratios broken by the base color scale updates. Fixes 251 of 278 failures; remaining 27 are pre-existing structural constraints that existed before our changes.
- Add borderColor.onMuted token to all 19 display colors in display.json5.
This new token is intended for borders rendered on top of display color
card backgrounds (display-{color}-bgColor-muted), solving a structural
impossibility where borderColor.emphasis cannot simultaneously satisfy
contrast requirements against both near-black page backgrounds (dark HC)
and very light pastel card backgrounds within the same theme.
- Update colorContrast.config.ts to test borderColor.onMuted (instead of
borderColor.emphasis) against display-{color}-bgColor-muted, reflecting
the intended usage split.
- Fix gray borderColor.emphasis dark overrides: steps were too dark to
contrast against near-black page backgrounds in dark themes.
dark: step 4→3, dark-HC/colorblind-HC/tritanopia-HC: step 5→3,
dark-dimmed-HC: step 5→2.
- Fix gray borderColor.onMuted: default step was too light for light-theme
gray card backgrounds. Default: step 4→6 (adds dark override at step 4
to preserve dark theme appearance), HC: step 5→7.
- Fix lime borderColor.onMuted: default step 5→6, HC step 6→7.
- Fix purple borderColor.onMuted: default step 4→5 (step 5 satisfies ≥3:1
against both light and dark bgColor-muted simultaneously).
Result: 0 contrast failures across all themes (down from 27 pre-existing
structural failures and 278 introduced by the brand scale update).
Resolve all contrast failures introduced by neutral and display scale
changes. Key fixes:
- Replace dark-mode neutral.13 refs with {base.color.white} where
semantically white (fgColor, buttons, avatar, header, syntax, etc.)
- Adjust display token emphasis/muted steps for new scale values
- Add HC theme overrides for bgColor-muted, bgColor-neutral-muted,
control.bgColor, and button-danger-bgColor
- Fix borderColor.emphasis default (neutral.8 → neutral.9)
- Reduce bgColor-success-muted alpha in dark-PD themes (0.2 → 0.15)
All 2579 contrast checks now pass across 13 themes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Design Token Diff (CSS)The message is too long to be displayed here. For more details, please check the job summary. |
Design Token Diff (StyleLint)The message is too long to be displayed here. For more details, please check the job summary. |
Design Token Diff (Figma)The message is too long to be displayed here. For more details, please check the job summary. |
- Copied neutral scale from PR #1369 brand refactor branch - Light: 13 steps with green-gray tones (fff0eb → 25292E) - Dark: 13 steps with inverted green-gray (ffddd2 → 460701) - Functional tokens NOT modified - only base scales - Ready for contrast analysis and functional token adjustments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Analysis findings: - Light mode emphasis backgrounds lose 60% contrast (unacceptable) - Dark mode text becomes unreadable (91% contrast loss) - Dark mode's warm color inversion breaks functional architecture - Some tokens improve significantly (dark emphasis +48%) Three implementation paths identified with tradeoffs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Analysis of color collisions when mapping old neutral scale to PR #1369: - Light theme: 7 new steps needed (0-7 compress into fewer tones) - Dark theme: 9 new steps needed (0-7 all map to same warm tone) Identified functional token usage across 5 files. Proposed two-phase approach: interpolate missing steps, then batch-update all token references. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Light mode: - Steps 0-4: white + interpolations toward PR #1369 brand palette - Steps 5-9: PR #1369 warm brand colors (orange/brown/red) - Steps 10-13: PR #1369 grays (dark brand colors) Dark mode: - Steps 0-7: preserved old cool grays (no warm inversion issues) - Step 8: kept as-is for smooth gray progression - Step 9: adjusted to #8E949F for better interpolation toward light grays - Steps 10-12: PR #1369 light gray section (preserved) - Step 13: white 14-step architecture maintains 1:1 token mapping, avoids collisions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ep 9 interpolation The dark.json5 file had accumulated formatting errors from the scale updates. This restores it to a clean state with: - Step 0: reference to base.color.black (from main) - Steps 1-8: preserved cool gray values - Step 9: #8E949F (interpolated value for smooth transition to PR #1369 grays) - Steps 10-12: PR #1369 light grays Validates successfully as JSON5. Build completes without errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- NEUTRAL_SCALE_COMPARISON.html: Interactive visual comparison showing: - Light and dark theme scales side-by-side - Touch-in-middle visualization: left=new, right=original, middle=split - PR #1369 reference colors with opacity for context - All 14 steps with hex values and contrast info - PR_SUMMARY.md: Comprehensive overview of changes including: - Color value changes for light and dark scales - Functional token mapping strategy - Validation results (tests, contrast, build) - Key design decisions and rationale Both files facilitate review and visual validation of scale refactor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ette Replace warm orange/brown brand colors with green-gray palette from PR #1369: - Steps 0-4: White to light green-gray gradient - Steps 5-9: Mid-tone green-grays - Steps 10-13: Dark green-grays to near-black This aligns with the cooler, more neutral aesthetic of PR #1369 while maintaining the 14-step scale structure for backward compatibility. Note: Functional tokens still reference old color values. Will be updated in follow-up commit after contrast analysis. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Extract actual light theme neutral colors from main branch (cool blue-grays) - Fix proposed colors to match PR #1369 green-gray palette exactly - Remove hard dividing line; use smooth gradients for visual blending - Add data tables showing hex values and changes per step - Update dark theme comparison (same palette for now) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
All color scales (blue, green, red, yellow, orange, purple, pink) restored to authentic values from main branch. Semantic colors correctly reference their respective scales (fgColor-accent uses blue.5, fgColor-success uses green.5, etc.). Baseline: 155 WCAG contrast failures - all legitimate due to light semantic text colors on light backgrounds. Next: Implement contrast fix strategy with PR #1369 green-gray palette tweaks and optional new intermediate steps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Applied PR #1369 green-gray neutral palette to both light and dark themes - Currently showing ~300 total contrast failures across all themes - Requires comprehensive functional token group migrations to fix - Next: identify which tokens need which step migrations
…failures - Expanded neutral scale from 14 to 15 steps (added interpolated neutral.9) - Renumbered old steps 9-13 to 10-14 in both light and dark palettes - Migrated 155+ functional token references to new step numbers - Applied all PR #1369 palette, functional, and component changes Current status: 340 contrast failures (vs 272 before scale expansion) Key issues identified: - fgColor-muted (#758479) insufficient contrast vs white/light backgrounds - control-fgColor-placeholder same issue - Display colors (accent/teal) insufficient contrast on emphasis Next: Fine-tune muted color step or apply additional tweaks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Brand Color Scale Alignment POC
This branch updates Primer Primitives' base and display color scales to align with the Brand Refactor color palette (Figma / Primer Brand). It's a proof of concept to assess feasibility, preview changes in dotcom, surface potential breaking changes early, and gather information for a full implementation.
What changed
1. Base neutral scales
The light and dark neutral scales were updated to match Brand Refactor's greenish-gray palette.
blackchanged from#1f2328(dark blue-gray) to#000000(true black).#fff) to#f2f5f3, which had downstream consequences (see below).2. Display hue scales aligned with base scales
The display hue scales (gray, blue, green, red, orange, yellow, purple, pink, coral) were realigned so that display colors derive from their base scale counterparts.
3. New
borderColor.onMuteddisplay tokensA new
borderColor.onMutedtoken was added for all display hues. This token is purpose-built for borders rendered on top ofbgColor-mutedbackgrounds, ensuring the border-on-muted contrast requirement is met independently fromborderColor-emphasis(which targets contrast againstbgColor-mutedfrom the page level).The contrast config was updated to check
borderColor-onMutedagainstbgColor-mutedinstead ofborderColor-emphasis. This was required to workaround contrast issues.4. Functional token adjustments
Many functional tokens needed step-level adjustments to maintain contrast with the new scale values:
fgColor.json5neutral.13→{base.color.white}for tokens semantically meaning white;accent/successbumped up stepsbgColor.json5mutedlight-HCn.3→n.2, dark-HCn.2→n.1);inverse/whitedark →{base.color.white};success-emphasisdarkgreen.5→6;success-muteddark-PD alpha0.2→0.15borderColor.json5emphasisneutral.8→9; dark modedefault/mutedstepped down for contrastcontrol.json5n.5→n.3,n.6→n.4);knob.checkeddark →{base.color.white}button.json5neutral.13fg refs →{base.color.white}; HC danger overrides adjusteddisplay.json5avatar.json5{base.color.white}header.json5{base.color.white}syntax.json5Key challenges
The neutral.13 ≠ white problem
The old neutral scale had step 13 as
#ffffff. Many dark-mode tokens referencedneutral.13to mean "white". When the new scale changed step 13 to#f2f5f3, all those tokens broke contrast.Fix: Replaced
{base.color.neutral.13}with{base.color.white}wherever the intent was a true white value. This is semantically cleaner but is a pattern change that needs to be applied consistently across the full token set.Contrast cascade
Changing scale hex values at the base level triggers a cascade of contrast failures in functional tokens. A single scale update can break dozens of theme × token combinations because:
Structurally impossible HC contrasts
Some high-contrast requirements are in tension. For example, a token may need to be:
When no single scale step satisfies both, custom hex values between scale steps are needed (an existing pattern in the codebase, see
fgColor.successlight-HC override).Breaking changes
This is a visually breaking change across the board:
Affected color token stats:
There are no structural breaking changes (no tokens renamed, removed, or added except
borderColor.onMuted).Risks and considerations
borderColor-emphasisonbgColor-mutedbackgrounds should migrate toborderColor-onMuted. Doing this in the implementation will require migration guidance.