ant-design / ant-design-colors

:art: Color Palettes Calculator of Ant Design
https://ant.design/docs/spec/colors
MIT License
652 stars 79 forks source link

tinycolor edge case #10

Open yuqianma opened 5 years ago

yuqianma commented 5 years ago

Try #002675 in https://ant.design/docs/spec/colors-cn#%E8%89%B2%E6%9D%BF%E7%94%9F%E6%88%90%E5%B7%A5%E5%85%B7

color-9 is outstanding here.

I found it is due to a tinycolor's feature: Tinycolor will convert number 0-1 to 0% - 100%

https://github.com/bgrins/TinyColor/blob/96592a5cacdbf4d4d16cd7d39d4d6dd28da9bd5f/tinycolor.js#L327

And value 1 runs into 100% right here.

We can certainly limit the value from 1 to 100 and 0. But how about use other lib like d3-hsv? Its s and v are simply within 0-1. (But no boundary check...)