# Color Gradient

The Color Gradient controls allows for the selection of two separate colors, for use in any situation that requires gradient colors (i.e. Header, footer, sidebar, etc...).

# Arguments

Name Type Default Description
type string color_gradient Value identifying the field type.
default string See Default Argument below.
validate string The only accepted validation type is color.
transparent bool true Flag to set the visibility of the transparency checkbox.

# Default Argument

Name Type Description
to string Hex string value for the left gradient color.
from string Hex string value for the right gradient color.

Transparency

To set the transparency checkbox by default, use the string transparent in place of a string hex value in either the to or from argument.

# Build Config

Build a Custom Configuration →
Changes you make to this form will be reflected in the generated code.
Field visibility requirements.

Redux::set_field( 'OPT_NAME', 'SECTION_ID', array(
    'type' => 'color_gradient'
) );

# Example Config

Redux::addField( 'OPT_NAME', 'SECTION_ID', array(
    'id'       => 'opt-color-gradient',
    'type'     => 'color_gradient',
    'title'    => __('Header Gradient Color Option', 'redux-framework-demo'),
    'subtitle' => __('Only color validation can be done on this field type', 'redux-framework-demo'),
    'desc'     => __('This is the description field, again good for additional info.', 'redux-framework-demo'),
    'validate' => 'color',
    'default'  => array(
        'from' => '#1e73be',
        'to'   => '#00897e', 
    ),
) );

# 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 'From color: ' . $redux_demo['opt-color-gradient']['from'];
echo 'To color: '   . $redux_demo['opt-color-gradient']['to'];