I was just trying this out and was getting an unexpected result where the returned "primary" colours where slightly different to the inputted base colour. This seems to come down to the base colour having two different values - "color" and "hslColor" (both of which are RGB colours).
For example, if I do var myColor = new compColors('#1ecbe1'), the value of myColor is:
Why the two slightly different RGB values here? A rounding issue? When converting these back to hex it seems the "color" variant is the accurate representation of the original hex. Unfortunately, it is the inaccurate "hslColor" variant that appears to be used in the calculations. So myColor.primary() for example returns [ { "r": 31, "g": 202, "b": 224 } ], and perhaps more importantly, the other colours (complementary etc) are slightly off too.
I was just trying this out and was getting an unexpected result where the returned "primary" colours where slightly different to the inputted base colour. This seems to come down to the base colour having two different values - "color" and "hslColor" (both of which are RGB colours).
For example, if I do
var myColor = new compColors('#1ecbe1')
, the value ofmyColor
is:Why the two slightly different RGB values here? A rounding issue? When converting these back to hex it seems the "color" variant is the accurate representation of the original hex. Unfortunately, it is the inaccurate "hslColor" variant that appears to be used in the calculations. So
myColor.primary()
for example returns[ { "r": 31, "g": 202, "b": 224 } ]
, and perhaps more importantly, the other colours (complementary etc) are slightly off too.