Multicolor

Multicolor Kirki

On Multicolor fields you can specify the options that will be available to your users by editing the choices argument and specifying an array of options as seen in the example below.

Example

new \Kirki\Field\Multicolor(
	[
		'settings'  => 'multicolor_setting',
		'label'     => esc_html__( 'Multicolor Control', 'kirki' ),
		'section'   => 'section_id',
		'priority'  => 10,
		'choices'   => [
			'link'     => esc_html__( 'Color', 'kirki' ),
			'hover'    => esc_html__( 'Hover', 'kirki' ),
			'active'   => esc_html__( 'Active', 'kirki' ),
		],
		'alpha'     => true,
		'default'   => [
			'link'   => '#0088cc',
			'hover'  => '#00aaff',
			'active' => '#00ffff',
		],
	]
);

Usage

<?php
$defaults = array(
	'link'   => '#0088cc',
	'hover'  => '#00aaff',
	'active' => '#00ffff',
);

$value = get_theme_mod( 'multicolor_setting', $defaults );

echo '<style>';
echo 'a { color: ' . $value['link'] . '; }';
echo 'a:hover { color: ' . $value['hover'] . '; }';
echo 'a:active { color: ' . $value['active'] . '; }';
echo '</style>';
?>

Was this helpful?