Skip to content

tinycolor edge case #10

@yuqianma

Description

@yuqianma

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...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions