Site logo

Archived topic

How to apply "real" global colorsfeature to GB & GP based site?

3 replies · Started by Sascha on October 20, 2020

Viewing posts 1–4 of 4

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

yes, i use code snippets plugin

This archived topic is closed to new replies.