[Support request] Central Color Palette Not Working with GP Alpha Pickers

Home Forums Support [Support request] Central Color Palette Not Working with GP Alpha Pickers

Home Forums Support Central Color Palette Not Working with GP Alpha Pickers

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

    I’m working with the Central Color Palette plugin but it doesn’t work on the GP Customizer Alpha pickers.

    print_r(array_column( get_option( 'kt_color_grid_palette' ), '0' ));

    Prints this but no #

    Array ( [0] => C40082 [1] => 0029E2 [2] => A7C900 [3] => 009E90 [4] => 00E5D6 [5] => 00337F [6] => 00DBA8 [7] => 00EA07 [8] => 00BC06 [9] => 007703 )

    Apparently Central Color Palette doesn’t prefix the #.

    This works but wondering if there might be a better way?

    add_filter( 'generate_default_color_palettes', 'gp_ccp_color_palettes', 10 );
    function gp_ccp_color_palettes( $palettes ) {
    $palettes = array_column( get_option( 'kt_color_grid_palette' ), '0' );
    foreach ( $palettes as &$hexclr ) {
    $hexclr = '#' . $hexclr;
    }
    return $palettes;
    }

    Here’s the contents of ‘kt_color_grid_palette’ option.

    a:11:{
    i:0;a:2:{i:0;s:6:"c40082";i:1;s:0:"";}
    i:1;a:2:{i:0;s:6:"0029e2";i:1;s:0:"";}
    i:2;a:2:{i:0;s:6:"a7c900";i:1;s:0:"";}
    i:3;a:2:{i:0;s:6:"009e90";i:1;s:0:"";}
    i:4;a:2:{i:0;s:6:"00e5d6";i:1;s:0:"";}
    i:5;a:2:{i:0;s:6:"00337f";i:1;s:0:"";}
    i:6;a:2:{i:0;s:6:"00dba8";i:1;s:0:"";}
    i:7;a:2:{i:0;s:6:"00ea07";i:1;s:0:"";}
    i:8;a:2:{i:0;s:6:"00bc06";i:1;s:0:"";}
    i:9;a:2:{i:0;s:6:"007703";i:1;s:0:"";}
    }
    #331607
    Tom
    Lead Developer
    Lead Developer

    Do the GP color pickers care if there’s no #? Usually they will just add it for you.

    If they do, then your code looks like it should work.

    #331710
    James

    That’s whole the problem the GP Customizer Alpha pickers do care and they don’t add it for you, hence my hacky code (did you even look at the code?). The WP pickers work fine with Central Color Palette.

    Central Color Palette is a very useful plugin so I guess I’ll make this a request: It would be nice if the GP Alpha pickers worked with Central Color Palette.

    Thanks!

    #331839
    Tom
    Lead Developer
    Lead Developer

    I’ll definitely look into it – first I’ve ever heard of it.

    Is the function you posted here not working for you?

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