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

Update: Return the color value on useColors #18544

Merged
merged 1 commit into from Nov 15, 2019

Conversation

@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Nov 15, 2019

Description

The useColors hook does not provide a way to access the color value.
If we want to create a slightly different color UI like the navigation block needs we need to access the color value.
Themes set the color property as the color value, and slug as the named color value, previously withColor also did that. Currently, useColors returns color as the named color.
This PR changes useColors to also return a color property in the color components, and returns the color slug in the slug property.

How has this been tested?

I verified the color on the heading block works as expected.
I used the debugger and verified the color and slug property contain the expected values for the three different cases: no color selected, custom color selected, preset color selected.

@jorgefilipecosta jorgefilipecosta force-pushed the update/pass-the-color-value-on-use-colors branch from fcf58c9 to 6dcce9c Nov 15, 2019
@jorgefilipecosta jorgefilipecosta requested a review from epiqueras Nov 15, 2019
Copy link
Contributor

draganescu left a comment

Tested with the heading component and found no issues because of the change. Also tested as part of #18540 where the change was used for a toolbar control and worked great.

@jorgefilipecosta jorgefilipecosta merged commit 58d85bb into master Nov 15, 2019
1 of 2 checks passed
1 of 2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Canceled
Details
@jorgefilipecosta jorgefilipecosta deleted the update/pass-the-color-value-on-use-colors branch Nov 15, 2019
@youknowriad youknowriad added this to the Gutenberg 7.0 milestone Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.