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

Retire numerous colors from the _colors.scss #23454

Merged
merged 9 commits into from
Jun 29, 2020
Merged

Conversation

jasmussen
Copy link
Contributor

This PR retires numerous colors from our color variables stylesheet.

Why? Because when we reduce the amount of available colors, it adds focus, clarity, simplicity, and helps tighten up the visual expression of the editor. You really shouldn't need 10 shades of gray, or even pick more than a few.

This also benefits the recently merged theme CSS variables for the spot color, and it benefits any future efforts the core project makes around the admin colors chemes.

There should be very few meaningful visual changes when you test this, perhaps the only ones that might jump out are:

Screenshot 2020-06-25 at 11 26 53

This placeholder text has slightly more contrast.

The dropzone is now opaque, and deliciously theme colored:

Screenshot 2020-06-25 at 11 36 00

@jasmussen jasmussen added [Type] Enhancement A suggestion for improvement. [Type] Code Quality Issues or PRs that relate to code quality labels Jun 25, 2020
@jasmussen jasmussen self-assigned this Jun 25, 2020
@jasmussen
Copy link
Contributor Author

Worth noting, I want to follow this one up with additional PRs that retire the remaining colors, plus another PR that adds a choice few colors.

I CC'ed you, @iamthomasbishop, because in working on this I did not touch any of the native stuff. I'm happy to touch that also, but wanted your thoughts first.

@github-actions
Copy link

github-actions bot commented Jun 25, 2020

Size Change: +44 B (0%)

Total Size: 1.13 MB

Filename Size Change
build/block-editor/index.js 109 kB +58 B (0%)
build/block-editor/style-rtl.css 10.7 kB -3 B (0%)
build/block-editor/style.css 10.7 kB -3 B (0%)
build/block-library/editor-rtl.css 7.58 kB -20 B (0%)
build/block-library/editor.css 7.58 kB -20 B (0%)
build/block-library/style-rtl.css 8.04 kB +5 B (0%)
build/block-library/style.css 8.05 kB +5 B (0%)
build/components/style-rtl.css 15.9 kB +6 B (0%)
build/components/style.css 15.9 kB +5 B (0%)
build/editor/style-rtl.css 3.84 kB -3 B (0%)
build/editor/style.css 3.85 kB -2 B (0%)
build/nux/style-rtl.css 671 B +8 B (1%)
build/nux/style.css 668 B +8 B (1%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/annotations/index.js 3.62 kB 0 B
build/api-fetch/index.js 3.4 kB 0 B
build/autop/index.js 2.82 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/index.js 7.39 kB 0 B
build/block-directory/style-rtl.css 941 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-library/index.js 130 kB 0 B
build/block-library/theme-rtl.css 730 B 0 B
build/block-library/theme.css 732 B 0 B
build/block-serialization-default-parser/index.js 1.88 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 48.2 kB 0 B
build/components/index.js 198 kB 0 B
build/compose/index.js 9.65 kB 0 B
build/core-data/index.js 11.4 kB 0 B
build/data-controls/index.js 1.29 kB 0 B
build/data/index.js 8.44 kB 0 B
build/date/index.js 5.47 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 569 B 0 B
build/dom/index.js 3.19 kB 0 B
build/edit-navigation/index.js 9.87 kB 0 B
build/edit-navigation/style-rtl.css 1.02 kB 0 B
build/edit-navigation/style.css 1.02 kB 0 B
build/edit-post/index.js 303 kB 0 B
build/edit-post/style-rtl.css 5.51 kB 0 B
build/edit-post/style.css 5.5 kB 0 B
build/edit-site/index.js 16.7 kB 0 B
build/edit-site/style-rtl.css 3.03 kB 0 B
build/edit-site/style.css 3.03 kB 0 B
build/edit-widgets/index.js 9.32 kB 0 B
build/edit-widgets/style-rtl.css 2.42 kB 0 B
build/edit-widgets/style.css 2.42 kB 0 B
build/editor/editor-styles-rtl.css 537 B 0 B
build/editor/editor-styles.css 539 B 0 B
build/editor/index.js 44.8 kB 0 B
build/element/index.js 4.65 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.72 kB 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 2.13 kB 0 B
build/html-entities/index.js 622 B 0 B
build/i18n/index.js 3.56 kB 0 B
build/is-shallow-equal/index.js 711 B 0 B
build/keyboard-shortcuts/index.js 2.51 kB 0 B
build/keycodes/index.js 1.94 kB 0 B
build/list-reusable-blocks/index.js 3.12 kB 0 B
build/list-reusable-blocks/style-rtl.css 450 B 0 B
build/list-reusable-blocks/style.css 451 B 0 B
build/media-utils/index.js 5.29 kB 0 B
build/notices/index.js 1.79 kB 0 B
build/nux/index.js 3.4 kB 0 B
build/plugins/index.js 2.56 kB 0 B
build/primitives/index.js 1.5 kB 0 B
build/priority-queue/index.js 788 B 0 B
build/redux-routine/index.js 2.85 kB 0 B
build/rich-text/index.js 14 kB 0 B
build/server-side-render/index.js 2.68 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.28 kB 0 B
build/url/index.js 4.06 kB 0 B
build/viewport/index.js 1.85 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

@@ -12,7 +12,8 @@ $dot-scale: 3; // How much the pulse animation should scale up by in size

&::before {
animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62);
background: rgba($blue-medium-800, 0.9);
background: rgba(#00739c, 0.9);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should use the theme colors (css vars)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should. But I don't know where we use these anymore, so I wasn't able to test this one, and it looks as if the rgba color opacity is animated, which we can't easily do with the CSS variables — right? So I left it alone for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

it's a deprecated component, so not very important for sure.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Cool PR

@jasmussen
Copy link
Contributor Author

I would love a bunch of eyes on this one. I consider it pretty safe because it only changes a few colors, and in almost all cases it will simply result in simplicity and better contrast. But in case there's an obscure place I missed a few beats, would love testing.

@ItsJonQ
Copy link

ItsJonQ commented Jun 25, 2020

Awesome @jasmussen ! I'm gonna give this a spin 🤞

@jasmussen
Copy link
Contributor Author

Thank you!

@@ -46,7 +46,7 @@
}

&:hover {
color: $blue-medium-400;
color: var(--wp-admin-theme-color);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, this one probably needs to be lighter, or just be removed. (Note to self)

@@ -12,7 +12,8 @@ $dot-scale: 3; // How much the pulse animation should scale up by in size

&::before {
animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62);
background: rgba($blue-medium-800, 0.9);
background: rgba(#00739c, 0.9);
opacity: 0.9;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line shouldn't have been committed. I'll remove it.

Copy link

@ItsJonQ ItsJonQ left a comment

Choose a reason for hiding this comment

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

@jasmussen I tested it a bunch in several browsers. Things look okay to me! There aren't any issues with build.

My only thought is that (maybe) 3rd party consumers of @wordpress/base-styles. We'd probably have to minor bump that would with migration info in changelogs.

Other than that, it's 🚀 from me!

@jasmussen
Copy link
Contributor Author

Awesome, thanks so much for testing, Q.

My only thought is that (maybe) 3rd party consumers of @wordpress/base-styles. We'd probably have to minor bump that would with migration info in changelogs.

I can put together a dev note for sure. But can you clarify this a little bit — wouldn't you have to be doing a full on fork in order for this to be an upgrade blocker? I.e. since these are SCSS variables, they aren't really surfaced in a meaningful way.

@youknowriad
Copy link
Contributor

I can put together a dev note for sure

No, this doesn't require a dev note more a "Breaking change" section on the CHANGELOG.md of the package because it's a breaking change for npm users, not for WordPress users.

@jasmussen
Copy link
Contributor Author

because it's a breaking change for npm users, not for WordPress users

I'll definitely help write that, but just for my own understanding, what makes this change breaking for NPM users compared to any other of the many SCSS change we make every day?

@youknowriad
Copy link
Contributor

@jasmussen we're probably doing similar breaking changes inadvertently. Removing a Sass variable is a breaking change for npm users as someone using the package can't ensure his own styles will continue to work after the update if he's using these variables.

@jasmussen
Copy link
Contributor Author

Oh of course, thank you.

I'd like to retire more, and do some renaming. But I meant to do that in a follow-up to not make the PR too big. But maybe I should do it all in one?

@youknowriad
Copy link
Contributor

It's fine to do multiple breaking changes for npm packages. (unlike WP). so just do separate PRs as usually, and if the version of the package is not out, you can just continue adding list items to the breaking changes in the CHANGELOG.md

@kjellr
Copy link
Contributor

kjellr commented Jun 26, 2020

🌟 This PR makes me so happy — we really do not need all those extra variables. The additional restraint here will help us all be more consistent in designing new pieces in Gutenberg, so I'm all for it.

I've taken this for a brief spin and haven't noticed anything that appears incorrect. 👍

@iamthomasbishop
Copy link

I CC'ed you, @iamthomasbishop, because in working on this I did not touch any of the native stuff. I'm happy to touch that also, but wanted your thoughts first.

Thanks for the ping, @jasmussen!

Short version: assuming there isn't anything here that breaks mobile, you can feel free to ignore mobile-specific stuff.

Long version: we will be revamping our color usage approach in the near future to make use of PlatformColor in RN with a fall-back to a cross-platform "neutral" system that feels natural on both platforms.

// ping @maxme let's keep this in mind when we tackle the colors work in the near future.

@jasmussen jasmussen force-pushed the try/retire-colors branch from 92c245e to 1902b50 Compare June 29, 2020 07:13
@jasmussen jasmussen mentioned this pull request Jun 29, 2020
@jasmussen
Copy link
Contributor Author

@youknowriad tests are passing and I'd love to merge, can you glance at my changelog update to see that I did it right?

@youknowriad
Copy link
Contributor

you did right since the other change is also marked as "unreleased" but in reality the other change is already released so I wonder why the changelog is not up to date. We probably missed a backport to master when we released the latest npm packages cc @gziolo

Feel free to merge this PR though.

@jasmussen jasmussen merged commit 6e80f44 into master Jun 29, 2020
@jasmussen jasmussen deleted the try/retire-colors branch June 29, 2020 14:50
@github-actions github-actions bot added this to the Gutenberg 8.5 milestone Jun 29, 2020
@gziolo
Copy link
Member

gziolo commented Jun 30, 2020

It should trigger the major version bump next time we do npm publishing. We have a very naive way of detecting version changes and it didn't match the header with higher importance than it should be. See the commit with a fix:

a689abb

@jasmussen jasmussen mentioned this pull request Jul 2, 2020
@ZebulanStanphill ZebulanStanphill mentioned this pull request Jul 3, 2020
6 tasks
jeherve added a commit to Automattic/jetpack that referenced this pull request Aug 3, 2020
jeherve added a commit to Automattic/jetpack that referenced this pull request Aug 4, 2020
jeherve added a commit to Automattic/jetpack that referenced this pull request Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants