Support » Plugin: Kirki Customizer Framework » Color Control w/Alpha

  • Resolved ThemeAWESOME

    (@tsquez)


    Hey there,

    Using latest version of Kirki: 3.0.16

    How can I set the default to be transparent in the color control with alpha?

    This is what I use

    XXXXXX_Kirki::add_field('xxxxxx_theme_customizer', array(
    	'type'        => 'color',
    	'settings'    => 'xxxxxx_main_sidebar_color_background',
    	'label'       => esc_attr__('Main Sidebar Background Color','xxxxxx'),
    	'tooltip'     => esc_attr__('Change the background color of the Main Sidebar.','xxxxxx'),
    	'section'     => 'xxxxxx_main_sidebar_color_section',
    	'default'     => 'transparent',
    	'priority'    => 1,
    	'transport'   => 'auto',
    	'choices'     => array(
    		'alpha' => true,
    	),
    	'output'      => array(
    		array(
    			'element' => '#right-sidebar',
    			'function' => 'css',
    			'property' => 'background-color',
    		),
    	),
    ) );

    Reason I ask, when I use it and select a color and plublish it works fine. Then when I hit “Default” to set it back, it keeps the same color that i chose. But if I set the alfa to transparent it takes?

    So I was wondering if I would use something like this:

    XXXXXX_Kirki::add_field('xxxxxx_theme_customizer', array(
    	'type'        => 'color',
    	'settings'    => 'xxxxxx_main_sidebar_color_background',
    	'label'       => esc_attr__('Main Sidebar Background Color','xxxxxx'),
    	'tooltip'     => esc_attr__('Change the background color of the Main Sidebar.','xxxxxx'),
    	'section'     => 'xxxxxx_main_sidebar_color_section',
    	'default'     => 'rgba(0,0,0,0)',
    	'priority'    => 1,
    	'transport'   => 'auto',
    	'choices'     => array(
    		'alpha' => true,
    	),
    	'output'      => array(
    		array(
    			'element' => '#right-sidebar',
    			'function' => 'css',
    			'property' => 'background-color',
    		),
    	),
    ) );

    Thanks, I appreciate any help you can give.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Aristeides Stathopoulos

    (@aristath)

    Yes, transparent is not a valid value for the colorpickers.
    You can use any valid HEX or RGBA value.
    If you want transparent just use rgba(0,0,0,0), rgba(255,255,255,0) or basically just anything with thea channel set to 0.

    The code from your 2nd example should work just fine 🙂

    OK yep worked great…just have to remember to raise the alpha when you select another color…lol or it stays at 0 hahahaha (freaked me out).

    Again, thanks for the answer and all that you do 😉

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Color Control w/Alpha’ is closed to new replies.