Add color picker to wordpress admin metafield

Step 1
Enqueue the script & stylesheet for the WordPress color picker.


Step 2
Add an id="my-color-selection" or class="my-color-selection" reference to the custom meta field you would like to use as the color picker.

You can also add a default color value="#ffffff" for the color picker and default value="#ffffff".
It should look as follows:


Step 3
Add the script that connects the color picker to the custom meta field you created.