Skip to content

Precision should configure digits AFTER the decimal point, not total digits #645

@jorenbroekema

Description

@jorenbroekema

In my opinion the current precision option in the Color.toString() method is very unintuitive.

E.g. I can have rounding issues with a low precision if my value is high. For example, a precision of 1 is not a problem when my lightness is 1%, but it is a problem when it is 95% because it would be rounded to 100%.

It would be much more intuitive if precision would dictate the amount of digits after the decimal point.

In case you disagree, coz I can imagine there's a reason for the current behaviour, can we then perhaps add a different option e.g. "decimals" to specify the amount of decimals (under the hood it would probably just do Number.toFixed(decimals))?

I'm happy to contribute

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