Home › Forums › Support › Integration between GeneratePress Customizer and GenerateBlocks Global Styles?
- This topic has 5 replies, 3 voices, and was last updated 3 years, 1 month ago by Tom.
-
AuthorPosts
-
February 25, 2021 at 2:34 pm #1672899Whelan
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?
February 25, 2021 at 2:54 pm #1672928LeoStaffCustomer SupportHi there,
Is this what you are looking for?
https://generatepress.com/forums/topic/add-custom-css-selector-to-the-button-selector/#post-1322768February 26, 2021 at 2:42 am #1673439WhelanThanks, 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; } );
February 26, 2021 at 11:08 am #1674169TomLead DeveloperLead DeveloperAre 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.
February 26, 2021 at 11:28 am #1674205WhelanYes 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
February 27, 2021 at 10:51 am #1675263TomLead DeveloperLead DeveloperAgreed – will get it done 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.