kirki icon indicating copy to clipboard operation
kirki copied to clipboard

Color / color-alpha fields documentation

Open peterhadorn opened this issue 11 years ago • 7 comments

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?

peterhadorn avatar Apr 08 '15 00:04 peterhadorn

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?

aristath avatar Apr 08 '15 01:04 aristath

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?

peterhadorn avatar Apr 08 '15 01:04 peterhadorn

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:

aristath avatar Apr 08 '15 01:04 aristath

Ok, no hurry :) Should I not post such documentation related issues in here as they are not bugs?

peterhadorn avatar Apr 08 '15 01:04 peterhadorn

Go ahead and post them... :) Any help is appreciated!

I'll just close these issues when I change the actual docs.

aristath avatar Apr 08 '15 01:04 aristath

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...

aristath avatar Apr 08 '15 19:04 aristath

New docs are now on this repository's wiki: https://github.com/reduxframework/kirki/wiki/color-alpha

aristath avatar May 24 '15 18:05 aristath