Archived topic
How to apply "real" global colorsfeature to GB & GP based site?
3 replies · Started by Sascha on October 20, 2020
Hi,
I have already tried to find similar posts here in forum as well as on FB, but the search-function of this forum is rather creating a chaos on my screen than showing a list of potentially relevant posts ;-)
So I have seen a reply by Tom where he provides a code snippet, that will alter the global-color-picker:
add_action( 'after_setup_theme', function() {
add_theme_support( 'editor-color-palette', array(
array(
'name' => __( 'Blue' ),
'slug' => 'blue',
'color' => '#59BACC',
),
array(
'name' => __( 'Green' ),
'slug' => 'green',
'color' => '#58AD69',
),
array(
'name' => __( 'Orange' ),
'slug' => 'orange',
'color' => '#FFBC49',
),
array(
'name' => __( 'Red' ),
'slug' => 'red',
'color' => '#E2574C',
),
) );
} );
I have applied this snippet to my site, "connected" the color "Blue" with some items,
then altered the hex-code of "Blue" to a red tone, saved, and expected all those connected items to automatically switch to this red tone.
Even with flushing all caches (server, browser etc.) the color of those with "Blue" connected items remained blue instead of red.
Could you please tell me about how to use, or establish, a color-palette-system, that is truly updating all items connected with the palette?
Thank you and kind regards,
Sascha
Hi there,
Can you first confirm that the code is added using one of the these methods?
Adding PHP: https://docs.generatepress.com/article/adding-php/
yes, i use code snippets plugin
Hi,
I believe this is where you got the code from?
https://generatepress.com/forums/topic/add-theme-support-editor-color-palette/
If you look closely, Tom added , 50 );, w/c is execution priority, on the code.
Can you try adding the priority arg value on your code as well? Let us know if it works.