Color / color-alpha fields documentation
This is only about the documentation on kirki.org, it states
"If your default value is an rgba value, then you can use either the color or the color-alpha values as the field type. If your default value is a hex value, then you will have to specify color-alpha as the field type."
But when I test it's only the color-alpha field that gives me the option to choose opacity, and the color fields work fine with hex default values. So isn't it the other way around than described?
Did you set an rgba value as default? this field for example should output a color-alpha control:
$controls[] = array(
'type' => 'color',
'setting' => 'color_demo',
'label' => __( 'This is the label', 'kirki' ),
'section' => 'color_section',
'default' => 'rgba(34,85,100,.4)',
'priority' => 10,
);
as will this:
$controls[] = array(
'type' => 'color-alpha',
'setting' => 'color_demo',
'label' => __( 'This is the label', 'kirki' ),
'section' => 'color_section',
'default' => 'rgba(34,85,100,.4)',
'priority' => 10,
);
and this:
$controls[] = array(
'type' => 'color-alpha',
'setting' => 'color_demo',
'label' => __( 'This is the label', 'kirki' ),
'section' => 'color_section',
'default' => '#333',
'priority' => 10,
);
This however will NOT have opacity:
$controls[] = array(
'type' => 'color',
'setting' => 'color_demo',
'label' => __( 'This is the label', 'kirki' ),
'section' => 'color_section',
'default' => '#333',
'priority' => 10,
);
Did I word it wrong in the docs, or is this a bug?
It's not a bug. I think it's just worded ambiguously, as color fields with hex default values work fine, but it implies that they don't?
ok, I'll review the docs tomorrow then. They're still a work in progress as you may have noticed already. :)
Thanks for the heads up! :+1:
Ok, no hurry :) Should I not post such documentation related issues in here as they are not bugs?
Go ahead and post them... :) Any help is appreciated!
I'll just close these issues when I change the actual docs.
As a sidenote, if you're using color-alpha controls please keep in mind that currently these don't work if there is no normal color control in your customizer as some assets have to be instantiated from there. I'm still trying to figure out why...
New docs are now on this repository's wiki: https://github.com/reduxframework/kirki/wiki/color-alpha