• Resolved psntr

    (@psntr)


    Hey,

    Thank you for creating this plugin. I can’t find how to simply return an dominant color in HEX, without having any other palettes or class. I generated all my palettes and it works on the backend of CMS.

    But now I want to add it in my PHP with my post thumbnail ID. How can I do that?

    Again thx for that plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Houke de Kwant

    (@houkedekwant)

    If you’re able to use code, you can use get_the_terms( post_id, 'cpg_dominant_color' ) In this case, post_id is the post thumbnail id. This will return an array of color codes. As their is only one dominant color you can do something like: $dominant = get_the_terms( post_id, 'cpg_dominant_color' ); $hex = $dominant[0]->slug;

    Plugin Author Houke de Kwant

    (@houkedekwant)

    Closing this one.

    Thread Starter psntr

    (@psntr)

    Thank you Houke!

    It works perfectly! Really useful.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to only return the dominant color’ is closed to new replies.