Skip to content

Use CSS color vars with fallback in legacy Primitive tokens - #4157

Merged
langermank merged 15 commits into
mainfrom
css-var-color-tokens
Jan 25, 2024
Merged

Use CSS color vars with fallback in legacy Primitive tokens#4157
langermank merged 15 commits into
mainfrom
css-var-color-tokens

Conversation

@langermank

@langermanklangermank commented Jan 18, 2024

Copy link
Copy Markdown
Contributor

Closeshttps://github.com/github/primer/issues/2987

As a followup to moving the legacy theme files into Primer React from Primer Primitives, this PR introduces the new v8 color CSS vars with fallbacks as the value of the JS variables. This allows us to staff ship v8 variables without rewriting all of our CSS upfront. It also may help with the theme flashing issue.

Code review

This looks like a lot of changes (it is) but the thing we are most concerned about is if the raw value has changes. The easiest way to see that is to primarily review the lefthand side to see which values have changed. There are a few intentional changes:

  • sometimes rgba transparent becomes transparent
  • the fg muted color was updated in a newer Primitives release which is reflected here
  • random bug fixes
diff view

Changelog

  • Adds CSS variable color values to the legacy Primitive design tokens.
  • Three values include: the new v8 color CSS variable, a fallback of the old color CSS variable, and the raw value.

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

We'll definitely want to test this against dotcom with an integration test PR.

Merge checklist

@changeset-bot

changeset-botBot commented Jan 18, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fbc0e26

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

This PR includes changesets to release 1 package
NameType
@primer/reactMinor

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

Comment threadsrc/legacy-theme/ts/colors/dark.ts
@github-actions

github-actionsBot commented Jan 18, 2024

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js113.83 KB (+8.96% 🔺)
dist/browser.umd.js114.47 KB (+8.91% 🔺)

Comment threadsrc/legacy-theme/ts/colors/dark.ts Outdated
},
expander: {
icon: '#7d8590',
icon: 'var(--diffBlob-expander-iconColor, var(--color-diff-blob-expander-icon, #848d97))',

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Note that these changes from 7d8590 to 848d97 are actually intended and correct ✅

@github-actions
github-actionsBottemporarily deployed to storybook-preview-4157 January 18, 2024 16:03 Inactive
@langermanklangermank added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jan 18, 2024
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jan 18, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4157 January 18, 2024 16:17 Inactive
@langermanklangermank added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jan 20, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4157 January 20, 2024 01:01 Inactive
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jan 20, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4157 January 20, 2024 01:08 Inactive
@langermanklangermank added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jan 22, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4157 January 22, 2024 17:53 Inactive
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jan 22, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4157 January 22, 2024 18:03 Inactive
@langermank
langermank marked this pull request as ready for review January 22, 2024 18:33
@langermank
langermank requested review from a team and joshblackJanuary 22, 2024 18:33
inputPlaceholderText: '#6e7681',
inputFocusText: '#e6edf3',
inputBg: '#161b22',
inputShadow: '0 0 0 1px (obj) => (0, get_1.default)(obj, path)',

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This has been broken for awhile, I replaced it with the correct value

@joshblackjoshblack 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.

LGTM! 🥳 I had two broader questions as it relates to this PR:

  • Is there any potential impact as it relates to how folks use themeGet? It seems like most people just use it to get a value versus interacting with it so seems like it should be good?
  • What's the best way for us to test this out in dotcom to make sure we're confident no styling issues make their way into a release?

@langermanklangermank added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jan 25, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4157 January 25, 2024 22:50 Inactive
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jan 25, 2024
@langermank
langermank added this pull request to the merge queueJan 25, 2024
Merged via the queue into main with commit aafa257Jan 25, 2024
@langermank
langermank deleted the css-var-color-tokens branch January 25, 2024 23:06
@primerprimerBot mentioned this pull request Jan 25, 2024
Sign up for freeto 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.

2 participants

@langermank@joshblack