Site logo

Archived topic

Custom Editor Palette not working

1 reply · Started by Communication on February 23, 2021

Viewing posts 1–2 of 2

Hi there,

I've been looking to add my own custom colors to the Gutenberg editor.

But it's still not working at all :
I can see my custom colors in the editor, but when selected, I can only see the change with the new color in the editor, but it's not changing on the website (no cache).
And it's working alright if I type another color code like #333333.
But not when trying to pick my own custom colors !

I've tried using those bit of codes in the function.php of my child theme :
- David's code here : https://generatepress.com/forums/topic/feature-request-add-commonly-used-colours-to-colour-palette/#post-1410261
- This one https://developer.wordpress.org/block-editor/developers/themes/theme-support/
- And even this last one :

<?php 
function mytheme_setup_theme_supported_features() {

	add_theme_support( 'editor-color-palette',
		array(
			array( 'name' => 'blue', 'slug'  => 'blue', 'color' => '#48ADD8' ),
			array( 'name' => 'pink', 'slug'  => 'pink', 'color' => '#FF2952' ),
			array( 'name' => 'green', 'slug'  => 'green', 'color' => '#83BD71' ),
			array( 'name' => 'yellow', 'slug'  => 'yellow', 'color' => '#FFC334' ),
			array( 'name' => 'red', 'slug'  => 'red', 'color' => '#B54D4D' ),
			array( 'name' => 'grey', 'slug'  => 'grey', 'color' => '#f8f8f8' ),
			array( 'name' => 'ui', 'slug'  => 'ui', 'color' => '#232634' ),
			array( 'name' => 'ui-dark', 'slug'  => 'ui-dark', 'color' => '#2F3344' ),
			array( 'name' => 'ui-light', 'slug'  => 'ui-light', 'color' => '#575D74' ),
		)
	);
}
add_action( 'after_setup_theme', 'mytheme_setup_theme_supported_features' );

Still exactly the same problem with all 3. What am I missing ?
Thanks a lot for your help !

Hi there,

your original topic slipped past our system, so I apologise for the late response,

the editors core color palette doesn't support RGBA ... you should still find its available in the GenerateBlocks plugin, where it is supported such as a Container Background.

And to the main issue ... you also have to add CSS Styles for the front end - see here:

https://developer.wordpress.org/block-editor/developers/themes/theme-support/#block-color-palettes

Or you may find the Central Color Palette plugin is a simpler method to managing this.

This archived topic is closed to new replies.