A WordPress plugin to automatically save the dominant colour and a colour palette for an attachment image into post_meta.
The dominant colour and colour palette is automatically saved on upload and edit to post meta.
You need to then use get_post_meta to retrieve the “dominant_color_hex” or “dominant_color_rgb” meta key. hex returns a string, including the #, rgb returns an array with key 0 as red, 1 as green, and 2 as blue.
Alternatively, you can use the meta keys “color_palette_rgb” and “color_palette_hex” to get an array of 8 colours that feature prominently in the image.
Contributors and Developers
“Dominant Colour” is open source software. The following people have contributed to this plugin.Contributors
“Dominant Colour” has been translated into 3 locales. Thank you to the translators for their contributions.
Translate “Dominant Colour” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Update to latest version of PHP Color Thief
Bump version requirements to match color thief and a modern-ish WordPress (5.4+)
Support translated languages (Submit your translation at translate.wordpress.org!)
Add a colour picker to the attachment edit screen to override the dominant colour with a custom pick.
The WordPress media gallery will now let you pick a dominant colour override which will be returned in place of dominant_color_hex/rgb when set.
It’ll also let you generate a palette for legacy images uploaded before you installed the plugin.