WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.56k stars 4.22k forks source link

Components: update color-related components — Tracking issue #35093

Open ciampo opened 3 years ago

ciampo commented 3 years ago

This is an overview issue to track all of the tasks necessary to refine the color-related components, especially in the context of using it in the updated Global Styles Sidebar.

Context

To visualize this, there are some good mockups in #34574 that illustrate the behavior above. Instead of duplicating all available color palettes for each a single item in a group is shown as a swatch plus a label:

step1

Click an item in the group drills down to a dedicated subpanel showing all available color tools:

step2

Here's an additional mockup that shows how the full flow for collapsible color swatches could work when used in editor inspector panels:

Color ItemGroup Flow i5

Please note that the precise visuals are subject to change per further work in #34574, so definitely defer to that ticket as the source of truth.

Essentially, multiple color properties are grouped together in an ItemGroup, as swatch+label.


Next steps

Note: This issue should be considered a draft, and will eventually supersede #33820

ColorSwatch

For more context of the conversation leading to ColorSwatch & more, see #33820.

ColorPicker

Please refer to #34284 for the work related to the updated ColorPicker component

Higher-level color components

With the new ColorSwatch and ColorPicker components, we're going to be able to look at higher-level color components (currently ColorPalette, CircularOptionPicker...)

We will need to reassess the new needs that these components need to fulfil. For example, the custom color and clear/reset features of ColorPalette may be assumed by other components (like the newly introduced ToolsPanel). And rather than rendering a palette of color options directly in the sidebar, we’ll be moving toward using ItemGroup to group color attributes. In Global Styles, clicking an Item will drill down to another sheet displaying the available color options and related components. In block sidebars, this action will likely result in a popover with similar controls.

ColorPalette

Gradient Picker & related

glendaviesnz commented 3 years ago

Has any consideration been given to the use of these components in a dropdown menu context along with the inspector panel?

I have been looking at https://github.com/WordPress/gutenberg/issues/20837, but currently the color/gradient controls seem very coupled to the inspector panels.

ciampo commented 3 years ago

Has any consideration been given to the use of these components in a dropdown menu context along with the inspector panel?

I have been looking at #20837, but currently the color/gradient controls seem very coupled to the inspector panels.

@jasmussen and @mtias may be better suited to answer this question

jasmussen commented 3 years ago

Has any consideration been given to the use of these components in a dropdown menu context along with the inspector panel?

I imagine the primary benefit of having a flyout version of the color swatch picker is that the flyout itself can be invoked either by an Item in the ItemGroup, or a button in the Toolbar. Here's how it could look for the Cover:

Toolbar ItemGroup

Edit: I've updated the above mockup to include a segmented control for gradients, which I previously forgot about. Some of the details could still be massaged, but the puzzle pieces should be in place.

javierarce commented 3 years ago

I like your design, @jasmussen, but there's something I'm starting to get worried about with the increased use of segmented controls: if we end up adding more items, we'll probably need to switch to a dropdown since segmented controls won't scale equally well in every language.

Maybe it's just me optimizing prematurely and we won't have more than two or three options in that flyout, but I'd consider exploring an option with a dropdown.

image

jasmussen commented 3 years ago

There are definitely cases where the segmented control won't work, good call. I do think that might be a bridge we need to cross when we get there. At the moment, "Linear" and "Radial" are both properties of the gradient control itself, which would make "Image" fit if that ends up being an addition.

ciampo commented 3 years ago

I like your design, @jasmussen, but there's something I'm starting to get worried about with the increased use of segmented controls: if we end up adding more items, we'll probably need to switch to a dropdown since segmented controls won't scale equally well in every language.

Maybe it's just me optimizing prematurely and we won't have more than two or three options in that flyout, but I'd consider exploring an option with a dropdown.

image

I believe a similar pattern is being explored for Typography Tools (#34345), where we switch between a segmented control and a dropdown for the Font sizes (depending on the number of items to display)

kellychoffman commented 3 years ago

Would like to propose a few minor tweaks for 5.9 to make the current color panel more intuitive and if i may... palatable. (While we are waiting for some improvements to land post 5.9.) If we can't get most of these in, I would hesitate to include this. @jasmussen - what do you think?

Screen Shot 2021-11-04 at 4 30 51 PM

For reference - the current experience is quite overwhelming.

color-overwhelming
jasmussen commented 3 years ago

I really like the color card in Global styles. It's primarily the fact that in the post editor it will nearly always show the transparency, which when duplicated like it is without the ItemGroup collapsing makes it lose much of its intrinsic meaning.

In that vein, I took a stab at Kelly's suggestion above in #36243. It's a quite hacky PR, and if it can be unhackified, it might be a better solution than reverting the card.

critterverse commented 3 years ago

One more thing to add to @kellychoffman's notes above — I think one thing that's hurting the readability is that there's not a very clear visual hierarchy between the section headings. Squinting at this image, the all caps palette headings almost appear heavier than the regular title case label:

color-section-heading-hierarchy

Setting the all caps labels in gray-800 would help those recede a bit.

jasmussen commented 3 years ago

Good call, that's another aspect. In the original context in which the card was designed, it's meant to be the entirety of the contents of the panel, meaning the sidebar header is the heading:

Screenshot 2021-11-05 at 14 19 07
shaunandrews commented 3 years ago

Shared a few ideas over on the related PR: https://github.com/WordPress/gutenberg/pull/36243#issuecomment-962057612

ciampo commented 3 years ago

Hey @kellychoffman @critterverse @shaunandrews! Since this is a tracking issue, would you mind opening a separate issue specific to discuss the Color Panel changes, and link to it from here?

Thank you!

kellychoffman commented 3 years ago

Added a design issue here: https://github.com/WordPress/gutenberg/issues/36543

markhowellsmead commented 2 years ago

Is there a reference anywhere for adding the new color picker component/s to a custom block? I’ve been using PanelColorSettings until now (which looks like this), but this omits the Standard color set and doesn't respect the settings in theme.json.

panelcolorsettings
ciampo commented 2 years ago

Is there a reference anywhere for adding the new color picker component/s to a custom block? I’ve been using PanelColorSettings until now (which looks like this), but this omits the Standard color set and doesn't respect the settings in theme.json.

Maybe @aaroncampbell or @jasmussen can help you out here?

jameskoster commented 2 years ago

Possibly one for consideration here: https://github.com/WordPress/gutenberg/issues/41868. And this one: https://github.com/WordPress/gutenberg/issues/41866

jasmussen commented 2 years ago

Is there a reference anywhere for adding the new color picker component/s to a custom block? I’ve been using PanelColorSettings until now (which looks like this), but this omits the Standard color set and doesn't respect the settings in theme.json.

Perhaps @jorgefilipecosta?

jorgefilipecosta commented 1 year ago

Is there a reference anywhere for adding the new color picker component/s to a custom block? I’ve been using PanelColorSettings until now (which looks like this), but this omits the Standard color set and doesn't respect the settings in theme.json.

panelcolorsettings

PanelColorSettings should automatically retrieve theme.json colors and settings if they are not passed. Using the ColorPalette from the block editor package should also automatically include colors and settings. What issues did you found if the color are not passed?