Site logo

Archived topic

Integration between GeneratePress Customizer and GenerateBlocks Global Styles?

5 replies · Started by Whelan on February 25, 2021

Viewing posts 1–6 of 6

Hi, I use the GP Premium Colors Module and the free version of GenerateBlocks. In my experience, the default GP Block button does not pick up the style I set in the Customizer - which is disappointing. Is there any more integration in the Pro version of GBlocks? i.e. is Global Styles synced with the GP Premium colors?

customizer screenshot

screenshot

Thanks, yes, that's almost perfect! I added some border styles and everything's working apart from the background color - it does not appear in editor mode. The css is not carried over correctly from GP to GB (see my screenshot of the inspector). Perhaps this is because it is semi-opaque RGBA? If I change it to a solid color, it works, but is there a way to use colors with alpha?

I see that GB handles background differently:

'backgroundColor' => '',
'backgroundColorOpacity' => 1,

However, what I ideally want is to control color and opacity via the GP Color Customizer interface.

My code (added as a snippet):

add_filter( 'generateblocks_defaults', function( $defaults ) {
    $color_settings = wp_parse_args(
        get_option( 'generate_settings', array() ),
        generate_get_color_defaults()
    );

    $defaults['button']['backgroundColor'] = $color_settings['form_button_background_color'];
    $defaults['button']['backgroundColorHover'] = $color_settings['form_button_background_color_hover'];
    $defaults['button']['textColor'] = $color_settings['form_button_text_color'];
    $defaults['button']['textColorHover'] = $color_settings['form_button_text_color_hover'];
	$defaults['button']['borderColor'] = 'inherit';
	$defaults['button']['borderSizeTop'] = '2px';
    return $defaults;
} );

Are your GP buttons using opacity? If so, that's likely the issue here.

Work definitely needs to be done in this area, as GB takes a hex color and an opacity value and creates an rgba value for you. Not ideal, one of the things I dislike about GB at the moment.

This is something I'll likely tackle in the next feature release - removing the opacity value and allowing the rgba value directly.

Yes opacity is the problem. GP Premium Customizer Color settings are inconsistent with GB settings. It would also be good if there was a border setting in the customiser.

I look forward to a feature release.... but the filter is fine for now. Thanks

Agreed - will get it done :)

This archived topic is closed to new replies.