One of the many new features in WordPress 3.5 is the Iris color picker. Iris replaces the, now deprecated, Farbtastic color picker script. The new Iris color picker is shown off in the Theme Customizer for the Twenty-Twelve theme.
As soon as I saw Iris, I fell in love. She is user-friendly, colorful and fun. I found that implementing the new color picker is very similar to Farbtastic.
Iris Color Picker Demo Plugin
To use the Iris color picker in a plugin requires:
- Running a version of WordPress that is 3.5 Beta or higher.
- Loading the ‘wp-color-picker’ script and style into your plugin options page.
- Adding a text input for your color value to your plugin options page.
- Writing a custom jQuery script to call Iris’s wpColorPicker method on your color text input field(s).
How does the code look for implementing steps 2-4?
I created a demonstration plugin to help answer that. The plugin doesn’t do anything itself, it is intended as a guide for developers interested in using the new Iris color picker in a WordPress plugin.