Custom Color Palette in WordPress Color Picker
-
I found this article on Custom Color Palette in WordPress Color Picker (it’s the one used for theme customisation etc. I want the custom palette colors on).
I tried putting the following in a child theme (based on SiteOrigin Vantage) and it changed nothing. Does this have to be implemented in the main theme? Or am I missing something else?
childtheme/functions.php code:
function custom_scripts() { wp_enqueue_script('custom_scripts', get_template_directory_uri() . '/js/custom.js'); } add_action('admin_enqueue_scripts', 'custom_scripts');
childtheme/js/custom.js code:
jQuery(function($) { if (typeof $.wp !== 'undefined' && typeof $.wp.wpColorPicker !== 'undefined') { $.wp.wpColorPicker.prototype.options = { // add your custom colors here palettes: [ '#556270', '#4ecdc4', '#c7f464', '#ff6b6b', '#c44d58', '#ecca2e', '#bada55' ] }; } });
Any help would be greatly appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom Color Palette in WordPress Color Picker’ is closed to new replies.