Color Set
The color-set
lets you add a field for selecting color.

Parameters
Here are the parameters in adding color-set
.
a unique slug-like string to use as an id and also as index in saving data in database.
the label of the field.
the description of the field and display under the label.
the section where the field will be displayed.
the default value of the field.
Note: default value must exist in colors.
determines the order of fields in section.
the list array of colors to be used.
the actual shape of color radio.
Note: shape valid values are 'square' and 'circle'.
the actual size of color radio, unit size is "px".
Example
Yano::field( 'color-set', [
'id' => 'colorsetdb1',
'label' => 'Choose Color 1',
'description' => 'Some description',
'section' => 'section_id',
'default' => '#000000',
'priority' => 14,
'colors' => [ '#000000', '#ffffff', '#eeeeee' ],
'shape' => 'square',
'size' => 20
] );
Yano provide material colors here are material color set : all
, primary
, a100
, a200
, a400
, a700
, red
, pink
, purple
, deepPurple
, indigo
, lightBlue
, cyan
, teal
, green
, lightGreen
, lime
, yellow
, amber
, orange
, deepOrange
, brown
, grey
and blueGrey
.
Yano::field( 'color-set', [
'id' => 'colorsetdb1',
'label' => 'Choose Color 1',
'description' => 'Some description',
'section' => 'sectisection_idon_1',
'default' => '#000000',
'priority' => 14,
'colors' => Yano_Util::_get_material_colors( 'all' ),
'shape' => 'square',
'size' => 20
] );
Usage
The get_theme_mod()
function is recommended to retrieve data.
// Return a string
echo get_theme_mod('colorsetdb1');