[Resolved] Integrate Elementor Color Palettes with GP Customizer Palettes

Home Forums Support Integrate Elementor Color Palettes with GP Customizer Palettes

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #324896
    James

    This assumes that you are using GP Premium (Colors) and Elementor Page Builder

    I expanded on
    generate_default_color_palettes
    because I wanted to integrate Elementor’s Global Colors and Color Picker colors with the GP Customizer color pickers.
    In Elementor, select your Global color scheme, your Elementor Color Picker scheme (modify as desired), and this replaces your GP Customizer color picker swatches with Elementors.

    Open for comments, critisisms or suggestions. If I get time I might make this a plugin, or maybe one of the experts can :).
    <?php

    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    if ( is_plugin_active( 'elementor/elementor.php' && 'gp-premium/gp-premium.php' ) ) {
    
    	add_filter( 'generate_default_color_palettes', 'elementor_global_color_palettes' );
    	function elementor_global_color_palettes( $palettes ) {
    		// Some pickers seem to require we start our array with key[0] so we use array_values.
    		$scheme_colors = array_values( get_option( 'elementor_scheme_color' ) );
    		$picker_colors = array_values( get_option( 'elementor_scheme_color-picker' ) );
    
    		/***   YOU CAN ONLY HAVE ONE INSTANCE OF $palettes UNCOMMENTED  ***/
    
    		/* **************************************************
    		If you want all 12 colors from the Elementor Global Colors and Picker Colors   */
    
    		//$palettes = array_merge( $scheme_colors, $picker_colors );
    
    		/* **************************************************
    		OR, If you have Elementor Global Colors disabled or just want the 8 colors from the Elementor Picker Colors   */
    
    		//$palettes = $picker_colors ;
    
    		/* **************************************************
    		Or, re-order, mix and match, comment out the ones you don't want. */
    
    		$palettes = array(
    			$scheme_colors[3],
    			$scheme_colors[1],
    			$scheme_colors[2],
    			$scheme_colors[0],
    			//$picker_colors[0],
    			//$picker_colors[1],
    			//$picker_colors[2],
    			//$picker_colors[3],
    			$picker_colors[7],
    			$picker_colors[5],
    			$picker_colors[6],
    			$picker_colors[4],
    		);
    
    		return $palettes;
    	}
    }
    GeneratePress 1.3.46
    #325056
    Tom
    Lead Developer
    Lead Developer

    Very cool – thank you for sharing! 🙂

    #351800
    Jose Pablo

    This has made my life much easier. Thanks!

    #367538
    Scott

    This is fantastic. Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.