Using color schemes with Color Picker

Don’t save everything as individual options, save all of your options as an array under a single key. One query to load it and save it, then just do all your manipulation in php.

example structure and output:

$colors = array(
    'current_scheme' => 'user_scheme',
    'preset_schemes' => array(
        'red' => array(
            'menu' => '#CC0000',
            'footer' => '#FF0000',
            'content' => '#CC0033'
        )
    ),
    'user_scheme' => array(
        'menu' => 'red',
        'footer' => 'red',
        'content' => '#132C3F' // override with custom color
    )
);
update_option( 'prefix_theme_options', $colors );

foreach( $colors['user_scheme'] as $location => $value ):
    echo $location . ': ';
    if( array_key_exists( $value, $colors['preset_schemes'] ) ):
        echo $colors['preset_schemes'][$value][$location];
    else:
        echo $colors['user_scheme'][$location];
    endif;
    echo '<br>';
endforeach;