Skip to content

Migrate React ANSI and Prettylights consumers to new token names with deprecated fallbacks#7832

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/update-deprecated-token-consumers
Open

Migrate React ANSI and Prettylights consumers to new token names with deprecated fallbacks#7832
Copilot wants to merge 3 commits into
mainfrom
copilot/update-deprecated-token-consumers

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Changelog

New

  • None.

Changed

  • Token consumer migration (no semantic behavior change)
    • Replaced deprecated ANSI usages with canonical-first fallbacks:
      • var(--color-ansi-*)var(--ansi-*, var(--color-ansi-*))
    • Replaced deprecated Prettylights usages with canonical-first fallbacks:
      • var(--color-prettylights-syntax-*)var(--prettylights-syntax-*, var(--color-prettylights-syntax-*))
  • Prettylights preferred-name normalization
    • Updated preferred token leaf names to camelCase where applicable (while retaining deprecated fallback names), including:
      • entity-tagentityTag
      • storage-modifier-importstorageModifierImport
      • string-regexpstringRegexp
      • constant-other-reference-linkconstantOtherReferenceLink
      • meta-diff-rangemetaDiffRange
      • sublimelinter-gutter-marksublimeLinterGutterMark
      • brackethighlighter-angle / brackethighlighter-unmatchedbracketHighlighterAngle / bracketHighlighterUnmatched
      • carriage-return-*carriageReturn-*
      • invalid-illegal-*invalidIllegal-*
  • Coverage scope
    • Updated all relevant @primer/react consumers in:
      • packages/react/src/legacy-theme/ts/colors/*
      • packages/react/src/legacy-theme/ts/color-schemes.ts
      • packages/react/src/Header/Header.dev.module.css
  • Fallback preservation
    • Kept existing hardcoded terminal fallbacks untouched by nesting them under deprecated-token fallback.
/* before */
color: var(--color-prettylights-syntax-comment, #57606a);

/* after */
color: var(
  --prettylights-syntax-comment,
  var(--color-prettylights-syntax-comment, #57606a)
);

Removed

  • None.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

  • Review token migration shape and ordering only:
    • New token first, deprecated token second.
    • Existing hardcoded color fallbacks preserved as final fallback.
  • Spot-check in:
    • legacy-theme/ts/colors/* for source theme token strings.
    • legacy-theme/ts/color-schemes.ts for generated/compiled scheme mappings.
    • Header.dev.module.css for direct CSS consumer usage.

Merge checklist

Original prompt

Migrate deprecated ANSI and Prettylights token consumers in primer/react to the new token names while preserving fallback compatibility.

Context:

  • primer/primitives is introducing new canonical token names:
    • ANSI: --color-ansi-* -> --ansi-*
    • Prettylights: --color-prettylights-syntax-* -> --prettylights-syntax-*
  • Prettylights leaf names should also be updated from kebab-case to camelCase where applicable.
  • Old names remain deprecated and should be kept as CSS fallbacks using the repo’s existing fallback style.
  • Do NOT modify primer/primitives in this task.
  • Create a PR only in primer/react.

Goal:
Update primer/react consumers to prefer the new token names while retaining deprecated-name fallbacks.

Requirements:

  1. Update all occurrences in primer/react that reference deprecated token names:
    • var(--color-prettylights... should become var(--prettylights..., var(--color-prettylights...))
    • var(--color-ansi... should become var(--ansi..., var(--color-ansi...))
  2. For prettylights tokens, also rename leaf names from kebab-case to camelCase where applicable in the new preferred token name. Examples:
    • --color-prettylights-syntax-entity-tag -> preferred --prettylights-syntax-entityTag
    • --color-prettylights-syntax-storage-modifier-import -> preferred --prettylights-syntax-storageModifierImport
    • --color-prettylights-syntax-string-regexp -> preferred --prettylights-syntax-stringRegexp
    • --color-prettylights-syntax-constant-other-reference-link -> preferred --prettylights-syntax-constantOtherReferenceLink
    • --color-prettylights-syntax-meta-diff-range -> preferred --prettylights-syntax-metaDiffRange
    • --color-prettylights-syntax-sublimelinter-gutter-mark -> preferred --prettylights-syntax-sublimeLinterGutterMark
    • --color-prettylights-syntax-brackethighlighter-angle -> preferred --prettylights-syntax-bracketHighlighterAngle
    • --color-prettylights-syntax-brackethighlighter-unmatched -> preferred --prettylights-syntax-bracketHighlighterUnmatched
    • --color-prettylights-syntax-carriage-return-text -> preferred --prettylights-syntax-carriageReturn-text
    • --color-prettylights-syntax-carriage-return-bg -> preferred --prettylights-syntax-carriageReturn-bg
    • --color-prettylights-syntax-invalid-illegal-text -> preferred --prettylights-syntax-invalidIllegal-text
    • --color-prettylights-syntax-invalid-illegal-bg -> preferred --prettylights-syntax-invalidIllegal-bg
  3. Keep the fallback ordering as: new token first, deprecated token second.
    • Example: var(--prettylights-syntax-comment, var(--color-prettylights-syntax-comment))
    • Example: var(--ansi-red, var(--color-ansi-red))
  4. Preserve all existing hardcoded final-value fallbacks where present.
    • Example: if the current value is var(--color-prettylights-syntax-comment, #57606a), update to:
      var(--prettylights-syntax-comment, var(--color-prettylights-syntax-comment, #57606a))
  5. Update all relevant files in primer/react, including legacy theme color files and any other consumer files found.
  6. Do not change semantics beyond token name migration.
  7. Run tests/lint if available and ensure the repo remains valid.

Known likely files from earlier search include:

  • packages/react/src/Header/Header.dev.module.css
  • packages/react/src/legacy-theme/ts/colors/light.ts
  • packages/react/src/legacy-theme/ts/colors/dark.ts
  • packages/react/src/legacy-theme/ts/colors/dark_dimmed.ts
  • packages/react/src/legacy-theme/ts/colors/dark_tritanopia.ts
  • packages/react/src/legacy-theme/ts/colors/dark_high_contrast.ts
  • packages/react/src/legacy-theme/ts/colors/dark_colorblind.ts
  • packages/react/src/legacy-theme/ts/colors/light_high_contrast.ts
  • packages/react/src/legacy-theme/ts/colors/light_tritanopia.ts
  • packages/react/src/legacy-theme/ts/colors/light_colorblind.ts
  • packages/react/src/legacy-theme/ts/color-schemes.ts

PR title should clearly indicate migration to new ANSI and Prettylights token names with fallbacks.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Read this issuek, how cabn we best address this: @github/core-ux/issues/2055

Assistant: Best approach: treat this as a compatibility rename, not a hard replacement.

I’d address github/core-ux#2055 in two layers:

  1. Introduce aliases/fallbacks immediately

    • Add var(--new-token, var(--old-token)) wherever the old color-prettylights-* tokens are referenced.
    • This gives you a safe migration path and matches the issue checklist.
    • Important: the correct CSS fallback shape is:
      var(--new-token, var(--old-token))
      not var(--new-token, --old-token).
  2. Then update usages to the new Primer token names

    • Follow the rename from primer/primitives#1352.
    • Replace old kebab-case prettylights token references with the new token names that use the current naming conventi...

This pull request was created from Copilot chat.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 12, 2026

🦋 Changeset detected

Latest commit: 73e117d

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

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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

…acks

Co-authored-by: lukasoppermann <813754+lukasoppermann@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate deprecated ANSI and Prettylights token consumers Migrate React ANSI and Prettylights consumers to new token names with deprecated fallbacks May 12, 2026
Copilot AI requested a review from lukasoppermann May 12, 2026 06:54
@lukasoppermann lukasoppermann marked this pull request as ready for review May 12, 2026 09:13
Copilot AI review requested due to automatic review settings May 12, 2026 09:13
@lukasoppermann lukasoppermann requested a review from a team as a code owner May 12, 2026 09:13
@lukasoppermann lukasoppermann requested a review from joshblack May 12, 2026 09:13
@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates @primer/react token consumers to prefer the new canonical ANSI (--ansi-*) and Prettylights (--prettylights-syntax-*) custom properties while retaining deprecated --color-ansi-* / --color-prettylights-syntax-* fallbacks to preserve compatibility.

Changes:

  • Updated legacy theme color maps to use canonical-first CSS variable fallbacks for Prettylights and ANSI tokens.
  • Normalized selected Prettylights preferred leaf names to camelCase in the new token names (while keeping deprecated fallbacks).
  • Updated Header.dev.module.css to use the new Prettylights token name with a deprecated fallback.
Show a summary per file
File Description
packages/react/src/legacy-theme/ts/colors/light.ts Migrates Prettylights/ANSI token references to canonical-first fallbacks for the light scheme.
packages/react/src/legacy-theme/ts/colors/light_tritanopia.ts Same migration for light tritanopia scheme.
packages/react/src/legacy-theme/ts/colors/light_high_contrast.ts Same migration for light high contrast scheme.
packages/react/src/legacy-theme/ts/colors/light_colorblind.ts Same migration for light colorblind scheme.
packages/react/src/legacy-theme/ts/colors/dark.ts Same migration for dark scheme.
packages/react/src/legacy-theme/ts/colors/dark_tritanopia.ts Same migration for dark tritanopia scheme.
packages/react/src/legacy-theme/ts/colors/dark_high_contrast.ts Same migration for dark high contrast scheme.
packages/react/src/legacy-theme/ts/colors/dark_dimmed.ts Same migration for dark dimmed scheme.
packages/react/src/legacy-theme/ts/colors/dark_colorblind.ts Same migration for dark colorblind scheme.
packages/react/src/legacy-theme/ts/color-schemes.ts Updates the generated color scheme mappings to align with the new canonical-first fallback pattern.
packages/react/src/Header/Header.dev.module.css Updates direct CSS consumer usage to the new Prettylights token name with deprecated fallback.

Copilot's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 10

Comment on lines +265 to +280
blackBright: 'var(--ansi-blackBright, var(--color-ansi-black-bright, #57606a))',
white: 'var(--ansi-white, var(--color-ansi-white, #6e7781))',
whiteBright: 'var(--ansi-whiteBright, var(--color-ansi-white-bright, #8c959f))',
gray: 'var(--ansi-gray, var(--color-ansi-gray, #6e7781))',
red: 'var(--ansi-red, var(--color-ansi-red, #cf222e))',
redBright: 'var(--ansi-redBright, var(--color-ansi-red-bright, #a40e26))',
green: 'var(--ansi-green, var(--color-ansi-green, #116329))',
greenBright: 'var(--ansi-greenBright, var(--color-ansi-green-bright, #1a7f37))',
yellow: 'var(--ansi-yellow, var(--color-ansi-yellow, #4d2d00))',
yellowBright: 'var(--ansi-yellowBright, var(--color-ansi-yellow-bright, #633c01))',
blue: 'var(--ansi-blue, var(--color-ansi-blue, #0969da))',
blueBright: 'var(--ansi-blueBright, var(--color-ansi-blue-bright, #218bff))',
magenta: 'var(--ansi-magenta, var(--color-ansi-magenta, #8250df))',
magentaBright: 'var(--ansi-magentaBright, var(--color-ansi-magenta-bright, #a475f9))',
cyan: 'var(--ansi-cyan, var(--color-ansi-cyan, #1b7c83))',
cyanBright: 'var(--ansi-cyanBright, var(--color-ansi-cyan-bright, #3192aa))',
Comment on lines +265 to +280
blackBright: 'var(--ansi-blackBright, var(--color-ansi-black-bright, #57606a))',
white: 'var(--ansi-white, var(--color-ansi-white, #6e7781))',
whiteBright: 'var(--ansi-whiteBright, var(--color-ansi-white-bright, #8c959f))',
gray: 'var(--ansi-gray, var(--color-ansi-gray, #6e7781))',
red: 'var(--ansi-red, var(--color-ansi-red, #cf222e))',
redBright: 'var(--ansi-redBright, var(--color-ansi-red-bright, #a40e26))',
green: 'var(--ansi-green, var(--color-ansi-green, #0550ae))',
greenBright: 'var(--ansi-greenBright, var(--color-ansi-green-bright, #0969da))',
yellow: 'var(--ansi-yellow, var(--color-ansi-yellow, #4d2d00))',
yellowBright: 'var(--ansi-yellowBright, var(--color-ansi-yellow-bright, #633c01))',
blue: 'var(--ansi-blue, var(--color-ansi-blue, #0969da))',
blueBright: 'var(--ansi-blueBright, var(--color-ansi-blue-bright, #218bff))',
magenta: 'var(--ansi-magenta, var(--color-ansi-magenta, #8250df))',
magentaBright: 'var(--ansi-magentaBright, var(--color-ansi-magenta-bright, #a475f9))',
cyan: 'var(--ansi-cyan, var(--color-ansi-cyan, #1b7c83))',
cyanBright: 'var(--ansi-cyanBright, var(--color-ansi-cyan-bright, #3192aa))',
Comment on lines +265 to +280
blackBright: 'var(--ansi-blackBright, var(--color-ansi-black-bright, #4b535d))',
white: 'var(--ansi-white, var(--color-ansi-white, #66707b))',
whiteBright: 'var(--ansi-whiteBright, var(--color-ansi-white-bright, #88929d))',
gray: 'var(--ansi-gray, var(--color-ansi-gray, #66707b))',
red: 'var(--ansi-red, var(--color-ansi-red, #a0111f))',
redBright: 'var(--ansi-redBright, var(--color-ansi-red-bright, #86061d))',
green: 'var(--ansi-green, var(--color-ansi-green, #024c1a))',
greenBright: 'var(--ansi-greenBright, var(--color-ansi-green-bright, #055d20))',
yellow: 'var(--ansi-yellow, var(--color-ansi-yellow, #3f2200))',
yellowBright: 'var(--ansi-yellowBright, var(--color-ansi-yellow-bright, #4e2c00))',
blue: 'var(--ansi-blue, var(--color-ansi-blue, #0349b4))',
blueBright: 'var(--ansi-blueBright, var(--color-ansi-blue-bright, #1168e3))',
magenta: 'var(--ansi-magenta, var(--color-ansi-magenta, #622cbc))',
magentaBright: 'var(--ansi-magentaBright, var(--color-ansi-magenta-bright, #844ae7))',
cyan: 'var(--ansi-cyan, var(--color-ansi-cyan, #1b7c83))',
cyanBright: 'var(--ansi-cyanBright, var(--color-ansi-cyan-bright, #3192aa))',
Comment on lines +265 to +280
blackBright: 'var(--ansi-blackBright, var(--color-ansi-black-bright, #57606a))',
white: 'var(--ansi-white, var(--color-ansi-white, #6e7781))',
whiteBright: 'var(--ansi-whiteBright, var(--color-ansi-white-bright, #8c959f))',
gray: 'var(--ansi-gray, var(--color-ansi-gray, #6e7781))',
red: 'var(--ansi-red, var(--color-ansi-red, #b35900))',
redBright: 'var(--ansi-redBright, var(--color-ansi-red-bright, #8a4600))',
green: 'var(--ansi-green, var(--color-ansi-green, #0550ae))',
greenBright: 'var(--ansi-greenBright, var(--color-ansi-green-bright, #0969da))',
yellow: 'var(--ansi-yellow, var(--color-ansi-yellow, #4d2d00))',
yellowBright: 'var(--ansi-yellowBright, var(--color-ansi-yellow-bright, #633c01))',
blue: 'var(--ansi-blue, var(--color-ansi-blue, #0969da))',
blueBright: 'var(--ansi-blueBright, var(--color-ansi-blue-bright, #218bff))',
magenta: 'var(--ansi-magenta, var(--color-ansi-magenta, #8250df))',
magentaBright: 'var(--ansi-magentaBright, var(--color-ansi-magenta-bright, #a475f9))',
cyan: 'var(--ansi-cyan, var(--color-ansi-cyan, #1b7c83))',
cyanBright: 'var(--ansi-cyanBright, var(--color-ansi-cyan-bright, #3192aa))',
Comment on lines +265 to +280
blackBright: 'var(--ansi-blackBright, var(--color-ansi-black-bright, #6e7681))',
white: 'var(--ansi-white, var(--color-ansi-white, #b1bac4))',
whiteBright: 'var(--ansi-whiteBright, var(--color-ansi-white-bright, #ffffff))',
gray: 'var(--ansi-gray, var(--color-ansi-gray, #6e7681))',
red: 'var(--ansi-red, var(--color-ansi-red, #ff7b72))',
redBright: 'var(--ansi-redBright, var(--color-ansi-red-bright, #ffa198))',
green: 'var(--ansi-green, var(--color-ansi-green, #3fb950))',
greenBright: 'var(--ansi-greenBright, var(--color-ansi-green-bright, #56d364))',
yellow: 'var(--ansi-yellow, var(--color-ansi-yellow, #d29922))',
yellowBright: 'var(--ansi-yellowBright, var(--color-ansi-yellow-bright, #e3b341))',
blue: 'var(--ansi-blue, var(--color-ansi-blue, #58a6ff))',
blueBright: 'var(--ansi-blueBright, var(--color-ansi-blue-bright, #79c0ff))',
magenta: 'var(--ansi-magenta, var(--color-ansi-magenta, #bc8cff))',
magentaBright: 'var(--ansi-magentaBright, var(--color-ansi-magenta-bright, #d2a8ff))',
cyan: 'var(--ansi-cyan, var(--color-ansi-cyan, #39c5cf))',
cyanBright: 'var(--ansi-cyanBright, var(--color-ansi-cyan-bright, #56d4dd))',
Comment on lines +265 to +280
blackBright: 'var(--ansi-blackBright, var(--color-ansi-black-bright, #6e7681))',
white: 'var(--ansi-white, var(--color-ansi-white, #b1bac4))',
whiteBright: 'var(--ansi-whiteBright, var(--color-ansi-white-bright, #ffffff))',
gray: 'var(--ansi-gray, var(--color-ansi-gray, #6e7681))',
red: 'var(--ansi-red, var(--color-ansi-red, #ff7b72))',
redBright: 'var(--ansi-redBright, var(--color-ansi-red-bright, #ffa198))',
green: 'var(--ansi-green, var(--color-ansi-green, #58a6ff))',
greenBright: 'var(--ansi-greenBright, var(--color-ansi-green-bright, #79c0ff))',
yellow: 'var(--ansi-yellow, var(--color-ansi-yellow, #d29922))',
yellowBright: 'var(--ansi-yellowBright, var(--color-ansi-yellow-bright, #e3b341))',
blue: 'var(--ansi-blue, var(--color-ansi-blue, #58a6ff))',
blueBright: 'var(--ansi-blueBright, var(--color-ansi-blue-bright, #79c0ff))',
magenta: 'var(--ansi-magenta, var(--color-ansi-magenta, #bc8cff))',
magentaBright: 'var(--ansi-magentaBright, var(--color-ansi-magenta-bright, #d2a8ff))',
cyan: 'var(--ansi-cyan, var(--color-ansi-cyan, #39c5cf))',
cyanBright: 'var(--ansi-cyanBright, var(--color-ansi-cyan-bright, #56d4dd))',
Comment thread packages/react/src/legacy-theme/ts/colors/dark_high_contrast.ts
Comment on lines +265 to +280
blackBright: 'var(--ansi-blackBright, var(--color-ansi-black-bright, #636e7b))',
white: 'var(--ansi-white, var(--color-ansi-white, #909dab))',
whiteBright: 'var(--ansi-whiteBright, var(--color-ansi-white-bright, #cdd9e5))',
gray: 'var(--ansi-gray, var(--color-ansi-gray, #636e7b))',
red: 'var(--ansi-red, var(--color-ansi-red, #f47067))',
redBright: 'var(--ansi-redBright, var(--color-ansi-red-bright, #ff938a))',
green: 'var(--ansi-green, var(--color-ansi-green, #57ab5a))',
greenBright: 'var(--ansi-greenBright, var(--color-ansi-green-bright, #6bc46d))',
yellow: 'var(--ansi-yellow, var(--color-ansi-yellow, #c69026))',
yellowBright: 'var(--ansi-yellowBright, var(--color-ansi-yellow-bright, #daaa3f))',
blue: 'var(--ansi-blue, var(--color-ansi-blue, #539bf5))',
blueBright: 'var(--ansi-blueBright, var(--color-ansi-blue-bright, #6cb6ff))',
magenta: 'var(--ansi-magenta, var(--color-ansi-magenta, #b083f0))',
magentaBright: 'var(--ansi-magentaBright, var(--color-ansi-magenta-bright, #dcbdfb))',
cyan: 'var(--ansi-cyan, var(--color-ansi-cyan, #39c5cf))',
cyanBright: 'var(--ansi-cyanBright, var(--color-ansi-cyan-bright, #56d4dd))',
Comment thread packages/react/src/legacy-theme/ts/colors/dark_colorblind.ts
Comment thread packages/react/src/legacy-theme/ts/color-schemes.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants