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

RGB(A) values returned aren't integers and result in error #35

Closed
denniszhao opened this issue Oct 21, 2014 · 2 comments
Closed

RGB(A) values returned aren't integers and result in error #35

denniszhao opened this issue Oct 21, 2014 · 2 comments

Comments

@denniszhao
Copy link

After scaling between two colors and calling .css(), the RGB values aren't rounded, and the decimal values can't be used.

e.g.

var scale = chroma.scale("YlGnBu");
console.log(scale(0.3).css())

will give:

rgb(170.20000000000002,221.8,182.8)

which is unusable (at least in Chrome v39). I think it'd be best to just round the number – not sure what a decimal value in RGB would represent, anyways 😄

I can submit a pull request in a couple of days after I find some time if you think this is a legitimate concern – would love to help out!

@yuchi
Copy link

yuchi commented Oct 21, 2014

Rounded values represent only a subset of the RGB color space. </pedantic>

@gka
Copy link
Owner

gka commented Oct 21, 2014

I agree, when outputting colors for CSS the RGB values should be rounded. Will fix this.

@gka gka closed this as completed in 27a4f83 Oct 21, 2014
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

3 participants