Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HSL to RGB forces rounding even with rgb(false) #333

Open
KeyboardDanni opened this issue Apr 4, 2024 · 0 comments
Open

HSL to RGB forces rounding even with rgb(false) #333

KeyboardDanni opened this issue Apr 4, 2024 · 0 comments

Comments

@KeyboardDanni
Copy link

KeyboardDanni commented Apr 4, 2024

The code in hsl2rgb.js is forcing the RGB components to be rounded to the nearest integer:

[r,g,b] = [round(c[0]*255),round(c[1]*255),round(c[2]*255)];

This means that even if you pass false to rgb(), the resulting color gets rounded. The issue does not occur with HSV.

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 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant