-
Notifications
You must be signed in to change notification settings - Fork 44
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
Conversation
🦋 Changeset detectedLatest commit: 99be152 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Variables changedNo variables changed |
🟢 No design token changes found |
src/platforms/css.ts
Outdated
|
||
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}"]`, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 likedata-dark-theme="light_colorblind"
. The only way you can get a light theme in dark mode is usingauto
.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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
There was a problem hiding this 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 |
---|---|
But I assume that's intended?
"@primer/primitives": patch | ||
--- | ||
|
||
Add Primitives v8 colors (private dist for testing) |
There was a problem hiding this comment.
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. 🤔
There was a problem hiding this comment.
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.
@simurai @lukasoppermann 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 Also, I the And these two, that I'm not sure 🤔 : |
@simurai thank you! Great catch, appreciate that attention to detail ✨ I fixed both 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. |
There was a problem hiding this 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
andbgColor-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.
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
disabled
ToggleSwitch hover state is a bug in PRC, not with primitivesWhat 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:
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 theprimary
border → Storybook linkSupporting resources (related issues, external links, etc):
Contributor checklist:
Reviewer checklist: