# Color
The Color field redefines simplicity. Point and click to choose any color in the spectrum.
Table of Contents
# Arguments
Name | Type | Default | Description |
---|---|---|---|
type | string | color | Value identifying the field type. |
transparent | bool | true | Flag to set the display of the transparency checkbox. |
validate | string | The only accepted validation type is color . | |
color_alpha | bool | false | Flag to set the color picker to accept an alpha value. |
Transparency
To set the transparency checkbox by default, use the string transparent
in place of a string hex value in the default
argument.
Also See
# Build Config
Build a Custom Configuration →
Changes you make to this form will be reflected in the generated code.
Redux::set_field( 'OPT_NAME', 'SECTION_ID', array(
'type' => 'color'
) );
# Example Config
Redux::set_field( 'OPT_NAME', 'SECTION_ID', array(
'id' => 'opt-color',
'type' => 'color',
'title' => esc_html__('Body Background Color', 'your-textdomain-here'),
'subtitle' => esc_html__('Pick a background color for the theme (default: #fff).', 'your-textdomain-here'),
'default' => '#FFFFFF',
'validate' => 'color',
) );
# Example Usage
This example in based on the example usage provided above. Be sure to change $redux_demo
to the value you specified in your opt_name argument.
global $redux_demo;
echo 'Color value: ' . $redux_demo['opt-color'];
← Color RGBA Content →