If you want to offer users the ability to pick a color through WordPress visual color picker interface on the admin side here is how you do it. Just like using WordPress native media uploader, using the WordPress color picker consists of 3 steps.

First lets enque the necessary scripts

Then create the color-picker.js file we’ve referenced in the above function and paste the following code in it:

Last but not least add a text field with the “color-filed” class in your options page:

Tip 1: Remember this will only populate the “yourplugin_color” field with the color you just picked. You still need to save this value to the DB like you would save a regular text field.