moagrius / Color

abstract Color management class for JavaScript; discreet component manipulation; output formatting; conversions.
http://moagrius.github.io/Color/Color.html
MIT License
21 stars 9 forks source link

HSB not mirrored in getHex() #8

Open matthewaudio opened 6 years ago

matthewaudio commented 6 years ago

Hi, just downloaded this project and found that this code

console.log(self.color.hue(),self.color.saturation(),self.color.brightness()); console.log(self.color.getHex(),self.color.getRGB());

yields this result in the console.

0 73 52.99999999999999 #000000 rgb(0, 0, 0)

And I'm struggling to find a way that this is my bug.
I've just got 3 sliders set up setting the H,S,B of the color. Any ideas?

moagrius commented 6 years ago

honestly i haven't touched this code in years but i can check it out. are you saying you're getting back those values from a newly instantiated Color instance?

matthewaudio commented 6 years ago

Hey... It looks like there are some other libraries that do approximately the same thing so no worries. I could investigate myself although I don't know the math.

What I'm saying is that the two lines of code I provided are in my program as show, executed one right after another and for some reason the first line yields the appropriate values but the rgb and hex gets yield zeros.

moagrius commented 6 years ago

got it, i'll check it out (some day), thanks for the note