color(sample)

Display a color picker field.

Option Details & Parameters

Type: color

Return: string

Can be placed in: Admin Panels , Admin Tabs , Meta Boxes , Theme Customizer

Parameter Type Description Ver
name string The name of the option, for display purposes only.
id string A unique ID for this option. This ID will be used to get the value for this option.
desc string The description to display together with this option.
default string The default value for this option.
alpha boolean If true, an additional control will become available in the color picker for adjusting the alpha/opacity value of the color. You can get rgba colors with the option. Defaults to false. 1.9
livepreview string (Optional) jQuery code that updates something in your site in the live preview. Only used when the option is placed in a theme customizer section. Refer to Livepreview for more information on this parameter.
css string (Optional) CSS rules to be used with this option. Only used when the option is placed in an admin page / panel or a theme customizer section. Refer to Generate CSS Automatically for your options for more information on this parameter.

Examples

Creating the option:

$panel->createOption( array(
'name' => 'My Color Picker Option',
'id' => 'background_color',
'type' => 'color',
'desc' => 'Pick a color',
'default' => '#555555',
) );