bgrins / TinyColor

Fast, small color manipulation and conversion for JavaScript
https://bgrins.github.io/TinyColor/
MIT License
5.05k stars 437 forks source link

Get first readable #85

Closed hackhat closed 9 years ago

hackhat commented 9 years ago

I know that is possible to do this with the API already provided but would be nice to have this. For example I have a list of possible colors and I would like to get the first one that is readable above a certain threshold.

bgrins commented 9 years ago

I think isReadable is what you want. You could iterate over your list and stop once you find one that fits your threshold.

hackhat commented 9 years ago

I know is possible, but a faster way could be possible. But this is your decision if is worth or not. I can make a pull request if you give me the ok.

bgrins commented 9 years ago

Since this is a fairly specific need and has an easy workaround, I think it'd be best to not expand the API to add that function.