Is there any way to customize the WordPress 3.8 color picker (on the custom field types) to use only colors i will define?
I need to have only 6 colors for a client, but they do not want to have all those colors, apart from 6 gradient colors.
Will be greatful for any help… I have been trying to do it for several days, but no positive solution:(
Thank you
WordPress 3.5+ uses the Iris colorpicker which has several options available for use.
When initializing the object just assign the
palettes
option with an array of colors.If your using TinyMCE editor you can modify the color palette like so.
We need to wp_enqueue_script the script and wp_enqueue_style the style with add_action to the functions.php file. Just include a jQuery file and stylesheet file by this script.
Now create a new javascript file as like cp-active.js and keep it avobe defined â/js/cp-active.jsâ file path using bellows code.
Add a textbox to your settings page with a CSS class for the color picker, where you want to dispaly the input text. I have use âcolor_codeâ for input $variable.
Please see more details on Add jQuery Color Picker WordPress Theme or Plugin
Here’s a quick & dirty solution:
_palettes:[“#000″,”#fff”,”#d33″,”#d93″,”#ee2″,”#81d742″,”#1e73be”,”#8224e3″]
Works for now. But haven’t tried yet if this survives the next WordPress update.