lokesh / color-thief

Grab the color palette from an image using just Javascript. Works in the browser and in Node.
https://lokeshdhakar.com/projects/color-thief/
MIT License
12.62k stars 1.32k forks source link

Exclude color in pallet output? #60

Open SauceDog opened 9 years ago

SauceDog commented 9 years ago

Is it possible to exclude a specific color (or a color range) in the pallet output? I would appreciate any help I could get on this (contact me if you can help freelance this request)

I have a collection of images with a border/frame around them then it would be helpful to specify the color of the border in order to ignore it and just focus on the actual images color pallet (without having to edit the originals, or just ignore a color for aesthetic reasons)

Dayjo commented 9 years ago

@SauceDog I gave this a go here; https://github.com/Dayjo/color-thief/commit/a4d82dba8e09bd5f2056805393f286dee4bd6c63#diff-0924104e5cce353ecb49b4758ecac07e though I've noticed it's not totally 100% reliable as the quantize function seems to change colour values. Might do what you need it to do though.

Ignore the changes to the Gruntfile, just wanted to build without compass.

fredrivett commented 6 years ago

+1 on this. Often if the image is a logo the colour it grabs is the white background, not the actual logo brand colour. Will look at @Dayjo's solution above, but try to avoid editing vendor files in general.