Site logo

Archived topic

Customizing GenerateBlocks Color Palette

26 replies · Started by Bodie on March 19, 2020

Viewing posts 16–27 of 27

Hello
Sorry to renew the topic, but i need help with same colors in Gutenberg blocks, i wanted to add my own colors and used the provided code by Tom plus additional ones i created, they work on back end but do not apply in the front end when the post is published same thing happen if i edit an old post and select from my new colors, they don't apply on front end when post is updated, just black text and no color.
What can be the problem?
Thank you.

Hi there,

can you start a new topic and share a link to a page where the problem is.

The code you gave replaces the colour palette. Could you provide to code to just add colours to the palette, leaving the previous colours there?

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 don't believe so. You'd need to add the original colors along with the new colors in the code.

Hi,

what a great thread. Thanks so much for this.

Is there a code which I can add transparency to the Generatepress customiser? Thanks.

Sorry, all fine the slider is there

Glad you found it :)

When adding to code snippets or child themes functions.php, the color-palette in Customizer remains unchanged :(

Aloha :)

The GenerateBlocks Color Palette code works great to color GenerateBlocks (containers, headlines).

But it seems to kill the ability to color a non-GenerateBlocks stuff, for example, a WP Paragraph block.

I'd rather not have to convert all my WP Paragraph blocks to GB Headlines (paragraph) .. what a chore.

Can the code be adjusted to apply to items outside the GB-sphere?

Oddly enough ... I can color (with code above) a WP Paragraph block in editing mode ... but doesn't show up live.

https://jumpshare.com/v/21IVBsgJfxmr2ldbLz3I

Happy Friday!

:)

Hi there,

Core blocks use the class system to style themselves (GB uses dynamic CSS). So, you'll need to add those classes to the your site stylesheet. For example:

.has-myred-color {
    color: red;
}

Hope this helps!

I would NEVER have figured that out!

You are indeed the best :)

Mahalo to all at GP!

Bill

Glad I could help! :)

This archived topic is closed to new replies.