color-thief
color-thief copied to clipboard
Update color-thief.js
for get dominant color if the file is white dominant
Hi,
In fact, the script skips the white pixels (>rgb(250,250,250)) of the image in order not to return white as the dominant color of an image with a white background like below :
I think that asserting that the dominant color of an image as the one above is white is not really accurate. However, if white is really part of the image (clouds in the sky, white clothes,...), it's true that it should be taken into account.
So maybe it would be better to add an option to indicate whether or not you want to ignore white pixels. Or, even better, add an option to specify one or more colors to ignore ?
I see similar behavior for a mostly-dark image. Can this be behavior be turned off in an option/parameter?
No, not yet.
it would be very nice to be able to have a flag to detect if white is the dominant color
I'd like to specifically detect when white is the dominant colour of the image.
@ksubileau @alexiskattan Would it be better to:
- Manual = send a color list to ignore as dominant
- Auto = allow for ignoring the first dominant color