Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Primitives v8 colors #529

Merged
merged 11 commits into from
Mar 28, 2023
Merged

Add Primitives v8 colors #529

merged 11 commits into from
Mar 28, 2023

Conversation

langermank
Copy link
Contributor

@langermank langermank commented Mar 26, 2023

Summary

A much cleaner version of #478 😄

This is the initial setup for testing our next major v8 release. Everything will be tested behind a feature flag to start, but ideally we avoid visual bugs by testing all of this in Storybook first! 🤞

Notes

  • I removed some GitHub specific tokens that we have moved to dotcom, such as Checks and some old marketing tokens
  • I'm keeping the shadow values the same for an easier rollout, and we can revisit later
  • All states are using our new formula with mix/alpha, which I will document soon
  • The disabled ToggleSwitch hover state is a bug in PRC, not with primitives

What should reviewers focus on?

This is a challenging PR to review. I would recommend focusing on visually testing in Storybook. Please focus on the following:

  • Ensure that I have copied over all a11y color updates correctly
  • Test the Button variants and states in all color themes. I did quite a bit of work on these. I feel like something might be off about the primary border → Storybook link
  • Test all "control" type components in all color themes → Storybook link
  • Scan through the comparison tables for large discrepancies → Storybook link

Supporting resources (related issues, external links, etc):

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change
  • Verify the design tokens changed in this PR are expected using the diffing results in this PR

@changeset-bot
Copy link

changeset-bot bot commented Mar 26, 2023

🦋 Changeset detected

Latest commit: 99be152

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 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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 26, 2023

Variables changed
No variables changed

@github-actions
Copy link
Contributor

github-actions bot commented Mar 26, 2023

🟢 No design token changes found

@github-actions github-actions bot temporarily deployed to storybook-preview March 26, 2023 15:28 Inactive
@langermank langermank temporarily deployed to github-pages March 26, 2023 15:28 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview March 26, 2023 15:29 Inactive
@langermank langermank marked this pull request as ready for review March 26, 2023 15:30
@langermank langermank requested a review from a team as a code owner March 26, 2023 15:30
@langermank langermank requested review from a team, rezrah and broccolinisoup March 26, 2023 15:30

return {
selector: `[data-color-mode="${mode}"][data-${mode}-theme="${themeName}"]`,
selector: `[data-color-mode="light"][data-light-theme="${themeName}"], [data-color-mode="dark"][data-dark-theme="${themeName}"]`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you changing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was working on updating the theme picker in Storybook last week with @colebemis and we found a bug with the selector stack. I think the theme picker was written in such a way that the theme would never fail to match the selector, and Cole suggested this change to make it match the logic in dotcom. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

If this is really the case, I will do a PR just for this, so that it is not hidden in this giant one and can be more easily tracked.

However I am not sure this is actually correct. Maybe @colebemis can add to this discussion.
In the current version we get the following:

[data-color-mode="light"][data-light-theme="light_colorblind"],
[data-color-mode="auto"][data-light-theme="light_colorblind"] {

or

[data-color-mode="dark"][data-dark-theme="dark_high_contrast"],
[data-color-mode="auto"][data-light-theme="dark_high_contrast"] {

With the proposed changes we get:

[data-color-mode="light"][data-light-theme="light_colorblind"],
[data-color-mode="dark"][data-dark-theme="light_colorblind"],
[data-color-mode="auto"][data-light-theme="light_colorblind"] {

or

[data-color-mode="light"][data-light-theme="dark_high_contrast"],
[data-color-mode="dark"][data-dark-theme="dark_high_contrast"],
[data-color-mode="auto"][data-light-theme="dark_high_contrast"] {

What is added is a line I think will never execute. As far as I see you can't get a combination of data-color-mode="dark" and a light theme like data-dark-theme="light_colorblind". The only way you can get a light theme in dark mode is using auto.

Am I missing something?

Copy link
Member

Choose a reason for hiding this comment

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

What is added is a line I think will never execute. As far as I see you can't get a combination of data-color-mode="dark" and a light theme like data-dark-theme="light_colorblind". The only way you can get a light theme in dark mode is using auto.

Am I missing something?

Yeah that's correct, in dotcom ui, when selecting single mode, you'll only get the corresponding data-color-mode to the stored theme value. The mismatch only happens if someone selects the opposite theme for there light/dark auto themes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing this change for now, and we can bring it back later if we find it necessary in dotcom!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, you're right. I got confused because that combination is technically possible in code. I didn't realize dotcom prevents that from happening

Copy link
Contributor

@simurai simurai left a comment

Choose a reason for hiding this comment

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

The diff is kinda hard to read. So I mostly clicked through Storybook.

Haven't really noticed anything except maybe the Banners in the dark theme:

Before After
Screen Shot 2023-03-27 at 18 23 20 Screen Shot 2023-03-27 at 18 22 40

But I assume that's intended?

Screen Shot 2023-03-27 at 18 22 07

"@primer/primitives": patch
---

Add Primitives v8 colors (private dist for testing)
Copy link
Contributor

@simurai simurai Mar 27, 2023

Choose a reason for hiding this comment

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

Do we have another name for this effort? It would be v3 of renaming efforts, although it doesn't match Primitives's current semver version. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to refer to this as the next major (v8) release of Primitives vs. v3, which I think sounds a little nicer and more accurate! In v8 we will also ship all the sizing tokens without fallbacks, so it truly feels like a big major release.

@langermank
Copy link
Contributor Author

@simurai @lukasoppermann I think I've addressed the alpha issue with status colors in dark mode 🤞

@langermank langermank temporarily deployed to github-pages March 27, 2023 15:29 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview March 27, 2023 15:29 Inactive
@langermank langermank temporarily deployed to github-pages March 28, 2023 00:40 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview March 28, 2023 00:41 Inactive
@simurai
Copy link
Contributor

simurai commented Mar 28, 2023

I think I've addressed the alpha issue with status colors in dark mode

Yes, Banners look good. 👍

Scanned through the Tables > Primitives in the dark theme again:

Replacing color-neutral-subtle with bgColor-neutral-muted would have a bigger color difference. Is that intentional? Haven't checked where we use that.

Screen Shot 2023-03-28 at 10 18 02

Also, I the bgColor-closed-muted seems to still use less transparency:

Screen Shot 2023-03-28 at 10 22 22

And these two, that I'm not sure 🤔 :

Screen Shot 2023-03-28 at 10 27 31

Screen Shot 2023-03-28 at 10 27 44

@langermank
Copy link
Contributor Author

@simurai thank you! Great catch, appreciate that attention to detail ✨

I fixed both bgColor-neutral-muted and bgColor-closed-muted. The other two I'm not really worried about. We introduced a new backdrop color with Overlay, and everyone felt it was too light. So I worked on a new value somewhere in between the new and old :D

I don't think that border token is used much, and we have more control now over "control" borders. So I'm essentially just removing it.

@langermank langermank temporarily deployed to github-pages March 28, 2023 02:38 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview March 28, 2023 02:38 Inactive
Copy link
Contributor

@simurai simurai left a comment

Choose a reason for hiding this comment

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

I fixed both bgColor-neutral-muted and bgColor-closed-muted.

👍 Ok, maybe good to ship? 😅

Doesn't mean everything needs to be super final and we can make follow-ups if we discover problems once we start to migrate to the new variables.

@github-actions github-actions bot temporarily deployed to storybook-preview March 28, 2023 18:01 Inactive
@langermank langermank merged commit 05edec6 into main Mar 28, 2023
@langermank langermank deleted the colors-primitives-v8 branch March 28, 2023 18:05
@primer-css primer-css mentioned this pull request Mar 28, 2023
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