Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Standardise & refactor colors scss to align with Gutenberg colors and WooCommerce brand. #3300

Merged
merged 16 commits into from
Oct 22, 2020

Conversation

Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Oct 20, 2020

Fixes #1331.

This PR:

  • Replaces several SCSS variables and hardcoded CSS values with variables from @wordpress/base-styles and @automattic/color-studio in order to align our colors with Gutenberg and WooCommerce brand. Notice that means this PR introduces some visual changes, but none should be too drastic since I tried to always use the closer match. We used to have many different shades of gray that are now reduced to 7, that's in line with what Gutenberg did to reduce the number of colors (Remove more colors WordPress/gutenberg#23648).
  • Decreases the specificity of price slider styles, so they are easier to theme + adds documentation on how to achieve it.
  • Adds a SCSS mixin (encode-color()) so SCSS variables can be used in SVG data-urls.

Tip: it might be easier to review this PR with the Hide whitespace changes option on GH.

Accessibility

I tested color contrast in several blocks to ensure there were no regressions.

Screenshots

Some screenshots:
imatge
imatge
imatge
imatge

How to test the changes in this Pull Request:

Test all blocks in editor/frontend and verify there are no evident issues with its display (layout completely broken or colors that are not correctly assigned). You can copy & paste this gist into the editor to automatically add all blocks. You might need to paste it with Ctrl+Shift+V so styles are removed and the editor can transform it into blocks.

Changelog

Updated several colors in blocks to align them with Gutenberg colors and WooCommerce brand.

@Aljullu Aljullu added status: needs review focus: global styles Issues that involve styles/css/layout structure. labels Oct 20, 2020
@Aljullu Aljullu added this to the 3.7.0 milestone Oct 20, 2020
@Aljullu Aljullu requested a review from a team as a code owner October 20, 2020 15:37
@Aljullu Aljullu self-assigned this Oct 20, 2020
@Aljullu Aljullu requested review from budzanowski and removed request for a team October 20, 2020 15:37
@github-actions
Copy link
Contributor

remove when `@woocommerce/base-styles` is updated.

remove when `@woocommerce/base-styles` is updated. Greys Use only when you truly need pure black. For UI, use $gray-900. Used for light gray backgrounds. Used sparingly for light borders. Used for most borders.


https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/77e0be9f1022aa8b9ea9d14e26c2c5be28179590/assets/css/abstracts/_colors.scss#L4-L20

🚀 This comment was generated by the automations bot based on a todo comment in 77e0be9 in #3300. cc @Aljullu

@github-actions
Copy link
Contributor

replace with $grid-unit values when `@woocommerce/base-st...

replace with $grid-unit values when `@woocommerce/base-styles` is updated. github.com/WordPress/gutenberg/blob/master/packages/base-styles/_variables.scss#L23-L36 $grid-unit-50


https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/77e0be9f1022aa8b9ea9d14e26c2c5be28179590/assets/css/abstracts/_variables.scss#L3-L14

🚀 This comment was generated by the automations bot based on a todo comment in 77e0be9 in #3300. cc @Aljullu

@github-actions
Copy link
Contributor

refactor breakpoints so they use the mixins from Gutenber...

refactor breakpoints so they use the mixins from Gutenberg github.com/WordPress/gutenberg/blob/master/packages/base-styles/_mixins.scss


https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/77e0be9f1022aa8b9ea9d14e26c2c5be28179590/assets/css/abstracts/_breakpoints.scss#L11-L15

🚀 This comment was generated by the automations bot based on a todo comment in 77e0be9 in #3300. cc @Aljullu

@github-actions
Copy link
Contributor

replace with $grid-unit values when `@woocommerce/base-st...

replace with $grid-unit values when `@woocommerce/base-styles` is updated. github.com/WordPress/gutenberg/blob/master/packages/base-styles/_variables.scss#L23-L36 $grid-unit-50


https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/800fd8a46ef9d89872b0880736cb2cf21d0bc0fc/assets/css/abstracts/_variables.scss#L3-L14

🚀 This comment was generated by the automations bot based on a todo comment in 800fd8a in #3300. cc @Aljullu

@github-actions
Copy link
Contributor

remove when `@woocommerce/base-styles` is updated.

remove when `@woocommerce/base-styles` is updated. Greys Use only when you truly need pure black. For UI, use $gray-900. Used for light gray backgrounds. Used sparingly for light borders. Used for most borders.


https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/800fd8a46ef9d89872b0880736cb2cf21d0bc0fc/assets/css/abstracts/_colors.scss#L4-L20

🚀 This comment was generated by the automations bot based on a todo comment in 800fd8a in #3300. cc @Aljullu

@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2020

Size Change: -240 B (0%)

Total Size: 1.12 MB

Filename Size Change
build/all-products.js 36.1 kB -2 B (0%)
build/editor-rtl.css 13.8 kB -9 B (0%)
build/editor.css 13.9 kB -7 B (0%)
build/featured-product.js 9.97 kB -2 B (0%)
build/single-product.js 10.1 kB -2 B (0%)
build/style-rtl.css 17.9 kB -109 B (0%)
build/style.css 17.9 kB -109 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/active-filters-frontend.js 8.81 kB 0 B
build/active-filters.js 8.85 kB 0 B
build/all-products-frontend.js 31.2 kB 0 B
build/all-reviews.js 9.78 kB 0 B
build/atomic-block-components/add-to-cart-frontend.js 8.95 kB 0 B
build/atomic-block-components/add-to-cart.js 7.52 kB 0 B
build/atomic-block-components/add-to-cart~atomic-block-components/button.js 3.18 kB 0 B
build/atomic-block-components/add-to-cart~atomic-block-components/image~atomic-block-components/title.js 335 B 0 B
build/atomic-block-components/button-frontend.js 2.02 kB 0 B
build/atomic-block-components/button.js 839 B 0 B
build/atomic-block-components/category-list-frontend.js 469 B 0 B
build/atomic-block-components/category-list.js 478 B 0 B
build/atomic-block-components/image-frontend.js 1.7 kB 0 B
build/atomic-block-components/image.js 1.15 kB 0 B
build/atomic-block-components/price-frontend.js 2.29 kB 0 B
build/atomic-block-components/price.js 2.32 kB 0 B
build/atomic-block-components/rating-frontend.js 524 B 0 B
build/atomic-block-components/rating.js 527 B 0 B
build/atomic-block-components/sale-badge-frontend.js 859 B 0 B
build/atomic-block-components/sale-badge.js 863 B 0 B
build/atomic-block-components/sku-frontend.js 386 B 0 B
build/atomic-block-components/sku.js 395 B 0 B
build/atomic-block-components/stock-indicator-frontend.js 568 B 0 B
build/atomic-block-components/stock-indicator.js 573 B 0 B
build/atomic-block-components/summary-frontend.js 917 B 0 B
build/atomic-block-components/summary.js 927 B 0 B
build/atomic-block-components/tag-list-frontend.js 467 B 0 B
build/atomic-block-components/tag-list.js 474 B 0 B
build/atomic-block-components/title-frontend.js 1.23 kB 0 B
build/atomic-block-components/title.js 1.06 kB 0 B
build/attribute-filter-frontend.js 18.2 kB 0 B
build/attribute-filter.js 12.4 kB 0 B
build/blocks.js 3.54 kB 0 B
build/cart-frontend.js 70 kB 0 B
build/cart.js 38.7 kB 0 B
build/checkout-frontend.js 85.9 kB 0 B
build/checkout.js 42 kB 0 B
build/featured-category.js 7.73 kB 0 B
build/handpicked-products.js 7.37 kB 0 B
build/price-filter-frontend.js 14.8 kB 0 B
build/price-filter.js 10.3 kB 0 B
build/product-best-sellers.js 7.45 kB 0 B
build/product-categories.js 3.23 kB 0 B
build/product-category.js 8.39 kB 0 B
build/product-new.js 7.61 kB 0 B
build/product-on-sale.js 8 kB 0 B
build/product-search.js 3.56 kB 0 B
build/product-tag.js 6.53 kB 0 B
build/product-top-rated.js 7.58 kB 0 B
build/products-by-attribute.js 8.33 kB 0 B
build/reviews-by-category.js 11.8 kB 0 B
build/reviews-by-product.js 13.4 kB 0 B
build/reviews-frontend.js 9.4 kB 0 B
build/single-product-frontend.js 33.8 kB 0 B
build/vendors-style-rtl.css 1.03 kB 0 B
build/vendors-style.css 1.03 kB 0 B
build/vendors.js 417 kB 0 B
build/vendors~atomic-block-components/price-frontend.js 5.65 kB 0 B
build/wc-blocks-data.js 7.1 kB 0 B
build/wc-blocks-middleware.js 931 B 0 B
build/wc-blocks-registry.js 2.32 kB 0 B
build/wc-payment-method-bacs.js 790 B 0 B
build/wc-payment-method-cheque.js 787 B 0 B
build/wc-payment-method-cod.js 879 B 0 B
build/wc-payment-method-paypal.js 831 B 0 B
build/wc-payment-method-stripe.js 12 kB 0 B
build/wc-settings.js 2.35 kB 0 B
build/wc-shared-context.js 1.53 kB 0 B
build/wc-shared-hocs.js 1.66 kB 0 B

compressed-size-action

Copy link
Contributor

@budzanowski budzanowski left a comment

Choose a reason for hiding this comment

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

Wow, great job! Lots of stuff here.

@github-actions
Copy link
Contributor

remove when `@woocommerce/base-styles` is updated.

remove when `@woocommerce/base-styles` is updated. Greys Use only when you truly need pure black. For UI, use $gray-900. Used for light gray backgrounds. Used sparingly for light borders. Used for most borders.


https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/c8de44956cc0071565950bfbac6fb66352897159/assets/css/abstracts/_colors.scss#L4-L20

🚀 This comment was generated by the automations bot based on a todo comment in c8de449 in #3300. cc @Aljullu

@github-actions
Copy link
Contributor

replace with $grid-unit values when `@woocommerce/base-st...

replace with $grid-unit values when `@woocommerce/base-styles` is updated. github.com/WordPress/gutenberg/blob/master/packages/base-styles/_variables.scss#L23-L36 $grid-unit-50


https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/c8de44956cc0071565950bfbac6fb66352897159/assets/css/abstracts/_variables.scss#L3-L14

🚀 This comment was generated by the automations bot based on a todo comment in c8de449 in #3300. cc @Aljullu

@Aljullu Aljullu merged commit a2c9c14 into trunk Oct 22, 2020
@Aljullu Aljullu deleted the update/styles-source branch October 22, 2020 10:40
@haszari haszari added the type: enhancement The issue is a request for an enhancement. label Oct 28, 2020
@haszari haszari changed the title Use @wordpress/base-styles and @automattic/color-studio as a base for our styles Standardise & refactor colors scss to align with Gutenberg colors and WooCommerce brand. Oct 28, 2020
@haszari haszari added the type: refactor The issue/PR is related to refactoring. label Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: global styles Issues that involve styles/css/layout structure. type: enhancement The issue is a request for an enhancement. type: refactor The issue/PR is related to refactoring.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settling on the correct source for global styles.
4 participants