jQuery(document).ready(function(jQuery) { // Color Scheme Options - These array names should match // the values in base_color_scheme of options.php // Dark Color Options var dark = new Array(); dark['primary_color']='#e4ff31'; dark['secondary_color']='#e4ff31'; // Light Color Options var light = new Array(); light['primary_color']='#6cff00'; light['secondary_color']='#6cff00'; // Vibrant Color Options var vibrant = new Array(); vibrant['primary_color']='#065667'; vibrant['secondary_color']='#065667'; // When the select box #base_color_scheme changes // it checks which value was selected and calls of_update_color jQuery('#base_color_scheme').change(function() { colorscheme = jQuery(this).val(); if (colorscheme == 'dark') { colorscheme = dark; } if (colorscheme == 'light') { colorscheme = light; } if (colorscheme == 'vibrant') { colorscheme = vibrant; } for (id in colorscheme) { of_update_color(id,colorscheme[id]); } }); // This does the heavy lifting of updating all the colorpickers and text function of_update_color(id,hex) { jQuery('#' + id).wpColorPicker('color',hex); } });