bgrins / TinyColor

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

return complement of black and white #117

Open khisakuni opened 8 years ago

khisakuni commented 8 years ago

complement method returns white as the complement of black, and black as the complement of white.

bgrins commented 8 years ago

I'm not sure how this should be defined with grayscale colors. Special casing white/black would still leave the same issue with something like:

tinycolor("rgb(1,1,1)").complement().toRgbString(); // "rgb(1, 1, 1)"
khisakuni commented 8 years ago

@bgrins Maybe the greyscale colors could have their lightness inverted too. For example if we have something like tinycolor({ h: 0, s: 0, l: .3 });, we would make that tinycolor({ h: 0, s: 0, l: .7 });