• Resolved sjonvugt

    (@sjonvugt)


    Hi, and thanks for the useful plugin.

    I’m creating a webpage where some elements will inherit the dominant colour of the featured image. I’ve managed to do so using some javascript, but it would be neater if this option was incorporated in the plugin, for example storing the featured image’s dominant colour in the document body. This reduces the need for javascript and the colour would be visible in custom block styles in the editor as well. Is this something that can be accomplished?

    Best regards,
    Sjon

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Hi Sjon,

    Thanks for reaching out, and thank you for your compliments on the plugin.

    I’d certainly be happy to pass on your suggestion to the team, or create a feature request on the plugins GitHub repository on your behalf for this. Before doing so, can you share more details on what you’d like to see changed from how we output the dominant color at present? For example, would you like this color to be available when editing a page/post, or display the dominant color code in the sidebar below the featured image?

    Thread Starter sjonvugt

    (@sjonvugt)

    Hi,

    That’s good to hear! The current output method is satisfactory. I could imagine you’d add an extra data-dominant-post-color (containing the featured image dominant colour) to the body tag, if this is activated in the plugin settings. For me, this would be sufficient.

    A further step would be to add the dominant post colour as a new category (e.g. “featured image color”) to the colour menu in the editor. This makes it easy to directly use it in any block. It would be even more useful if you can select from a palette of colours from the featured image, as the most dominant one is not always the ‘best’ option. (The last screenshot comes from the Dominant Colour plugin.)

    This is how I would use it, but there may be other approaches.

    Plugin Support James Osborne

    (@jamesosborne)

    I’m happy to open a GitHub issue for you if you wish @sjonvugt.

    I could imagine you’d add an extra?data-dominant-post-color?(containing the featured image dominant colour) to the?body?tag

    A dominant color is applied to all images within the body, independently generated on a per image basis. As it’s not only the featured image that has a dominant color, would you like a dedicated featured image dominant color style added (example), so you could reuse that within a post?

    It would be even more useful if you can select from a?palette of colours?from the featured image

    There is an open trac ticket for selecting a dominant color which you may be interested in. You’ll find more details on this here. Based on your screenshot I can create a GitHub issue for the team to review if you wish, based on a possible image block setting for images to select a dominant color.

    Thread Starter sjonvugt

    (@sjonvugt)

    Thanks for your reply.

    Yes, a dedicated featured image dominant color style would be beneficial. I’m aware that all images have an individual dominant color, I figured using the color of the featured image in the post content would be the most logical. If you can open an issue that’s appreciated!

    The trac ticket on adding the dominant colour could indeed work with my screenshot, so that you can select a dominant color per image in the media library. A user might even want to set a custom hex value for certain images in specific use cases. This is an interesting topic to explore, I’m not fully sure as to what solution will be the best.

    Plugin Support James Osborne

    (@jamesosborne)

    I’ve created the following GitHub issue for the team to review and consider. You can keep watch of this below:
    https://github.com/WordPress/performance/issues/693

    Let me know if you wish for me to make any changes to this, or feel free to chime in yourself with any comments. I’ll close this support topic now that this has been created. Many thanks for the suggestion!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Dominant colour of featured image’ is closed to new replies.