bgrins / TinyColor

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

Support precision option? #162

Open 599316527 opened 7 years ago

599316527 commented 7 years ago

toString() functions use Math.round directly to turn values into integer. But for hue, saturation, lightness, value and alpha values, decimal part are important for representing accurate colors.

Adding an option of precision will make sense.

tinycolor('#F5F405').toHslString({ precision: 4 }) === 'hsl(59.751, 96.7729%, 48.8228%)'