Open KeyboardDanni opened 3 months ago
The code in hsl2rgb.js is forcing the RGB components to be rounded to the nearest integer:
hsl2rgb.js
https://github.com/gka/chroma.js/blob/cd1b3c0926c7a85cbdc3b1453b3a94006de91a92/src/io/hsl/hsl2rgb.js#L31
This means that even if you pass false to rgb(), the resulting color gets rounded. The issue does not occur with HSV.
false
rgb()
Minimal reproduction:
import chroma from "chroma-js"; let color = chroma.hsv(260, 0.5, 0.5); let colorRgb = color.rgb(false); // [ 84.99999999999999, 63.75, 127.5 ] color = chroma.hsl(260, 0.3333333333333333, 0.375); colorRgb = color.rgb(false); // [ 85, 64, 128 ]
The code in
hsl2rgb.js
is forcing the RGB components to be rounded to the nearest integer:https://github.com/gka/chroma.js/blob/cd1b3c0926c7a85cbdc3b1453b3a94006de91a92/src/io/hsl/hsl2rgb.js#L31
This means that even if you pass
false
torgb()
, the resulting color gets rounded. The issue does not occur with HSV.Minimal reproduction: