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

Block Editor Color Palette: Only custom color palettes are displayed #64857

Closed
2 tasks done
t-hamano opened this issue Aug 28, 2024 · 5 comments · Fixed by #65148
Closed
2 tasks done

Block Editor Color Palette: Only custom color palettes are displayed #64857

t-hamano opened this issue Aug 28, 2024 · 5 comments · Fixed by #65148
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Package] Block editor /packages/block-editor

Comments

@t-hamano
Copy link
Contributor

Description

If the custom color palette is defined in the global styles, the color palette in the block editor package only shows that custom color palette.

Note that I'm talking about the ColorPalette component in the block editor package, not the ColorPalette component in the components package.

This issue can be seen in color inline formatting and Cover block placeholder. From what I've tested in Playground, this problem appears to have been occurring since at least WP6.3. As I recall, all palettes - theme, default, and custom - were displayed in the past.

Step-by-step reproduction instructions

  • Add a custom color palette with the global styles.
  • Add a cover block or apply inline color to the text.

Screenshots, screen recording, code snippet

Cover block and text color format. Only custom colors are shown:

custom-color

If no custom color is defined, the theme color is displayed:

image

Like color block support, it should display all three colors default, theme, and custom:

image

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Package] Block editor /packages/block-editor labels Aug 28, 2024
@EddyBoels
Copy link

Same here. If you create a custom colour in the styles, then in a text block, the highlight option will only offer this colour without the basic palette.

@t-hamano
Copy link
Contributor Author

I've confirmed that this issue has been occurring since at least WP 6.0.

@rohitmathur-7
Copy link
Contributor

Hii @t-hamano ,
I was also checking this issue recently and found this related Issue from February:
#59171

Here it is mentioned that we are getting the custom colors from this code:

$editor_settings['__experimentalFeatures'] = wp_get_global_settings();
// These settings may need to be updated based on data coming from theme.json sources.
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
$colors_by_origin          = $editor_settings['__experimentalFeatures']['color']['palette'];
$editor_settings['colors'] = isset( $colors_by_origin['custom'] ) ?
	$colors_by_origin['custom'] : (
		isset( $colors_by_origin['theme'] ) ?
			$colors_by_origin['theme'] :
			$colors_by_origin['default']
	);
}

But when I was checking this in my local I modified this code to set the value of $editor_settings['colors'] as $colors_by_origin['theme'] for testing but still I was getting the custom colors only 🤔 .

@burnuser
Copy link

burnuser commented Oct 1, 2024

This is a very problematic bug, since providing custom colors in the color palette is a central function in the adaption of (FSE-) Themes.

But the described bug is still unresolved in WordPress 6.7. Beta 1

For me, personally, this bug makes the whole FSE color palette system unusable. So I have to use plugins or CSS to replace a so called FSE WordPress core function ins styles.

Am I really the only one who has a problem with this?

Is WP 6.7 really planed to ship with this bug unresolved?

@richtabor richtabor added [Block] Cover Affects the Cover Block - used to display content laid over a background image and removed [Type] Bug An existing feature does not function as intended labels Nov 7, 2024
@richtabor
Copy link
Member

@AKSHAT2802 I left a review on #65148. Would appreciate a follow-up to get this through; it's close. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Package] Block editor /packages/block-editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants