Support » Plugin: Kirki » Alpha color not working and debug error

  • Resolved WebTrooper

    (@webtrooper)



    Following the instructions at https://aristath.github.io/kirki/docs/controls/color.html I added 'choices' => array( 'alpha' => true ) to my color field but it doesn’t work –
    I don’t get the opacity slider in the color selector.

    I tried doing it the old fashion way by simply adding 'alpha' => true, directly into the arguments. That does show the opacity slider, but then js_vars is broken.

    Also, adding 'alpha' => true, directly to the arguments throws the following debug error:

    Notice: Kirki::add_field was called incorrectly. Do not use “alpha” as an argument in color controls. Use “choices[alpha]” instead.

    But on saving it does save the rgba color as it should. Is this a bug or am I missing something?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • UPDATE: I found a post mentioning to use 'type' => 'color-alpha' and that gave me the opacity slider, but js_vars was still not working. So I removed js_vars and simply used my postMessage.js file to handle the live update. This works.

    Plugin Author Aristeides Stathopoulos

    (@aristath)

    @webtrooper I’m unable to replicate your issue so far…
    This code seems to be working fine:

    Kirki::add_field( 'my_theme', array(
    	'type'        => 'color',
    	'settings'    => 'color_control_demo',
    	'description' => esc_attr__( 'Description.', 'kirki-demo' ),
    	'label'       => __( 'Color Control', 'kirki-demo' ),
    	'section'     => 'dummy_section',
    	'default'     => '#333333',
    	'priority'    => 10,
    	'transport'   => 'auto',
    	'choices'     => array(
    		'alpha' => true,
    	),
    	'output' => array(
    		array(
    			'element'  => 'body',
    			'property' => 'background-color',
    		),
    	),
    ) );

    Could you please post the code you’re using? Are you doing something different?

    Plugin Author Aristeides Stathopoulos

    (@aristath)

    After a long time I was finally able to locate the issue and a fix for this will be included in version 3.0.12 which will be released in a few days (currently in final testing stage).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Alpha color not working and debug error’ is closed to new replies.