bgrins / TinyColor

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

HSL: Saturation = 1 returns fully saturated color #203

Closed getflourish closed 5 years ago

getflourish commented 5 years ago

When getting the hex string of a non saturated color, a fully saturated color is returned.

The example compares a color with saturation = 1 and saturation = 0, whereas 1 returns full saturation. While 2 returns low saturation.

image

https://codepen.io/getflourish/pen/WYVNoV


let a = tinycolor({
      h: 0,
      s: 0,
      l: 52
    }).toHexString()

let b = tinycolor({
      h: 0,
      s: 1,
      l: 52
    }).toHexString()

let c = tinycolor({
      h: 0,
      s: 2,
      l: 52
    }).toHexString()
getflourish commented 5 years ago

Oh, I figure, I should explicitly add "%" to the values.