Closed joshuabaker closed 5 years ago
I think a way to do it would be to convert the colors to HSL, and then average the lightness of the dominant colors.
I'd then make this available via a property on the image, so you can decide what level of lightness determines it being light or dark.
Thanks!
A nice addition to the dominant color calculation would be to color contrast for each, or overall (i.e. using the YIQ color space).
This could help identify if any accompanying overlay text should be dark or light.