We have something like this in a color picker wheere hue value is changed from a hue slider:
const newColor: HslaColor = {
h: element.value,
s: this.saturation,
l: this.lightness,
a: this.alpha / 100,
};
this.setColor(newColor);
Inside setColor() function:
setColor(colorString: string | HslaColor) {
const colord = new Colord(colorString);
const { h, s, l, a } = colord.toHsl();
this.hue = h;
this.saturation = s;
this.lightness = l;
this.alpha = this.opacity ? a * 100 : 100;
const hslaColor = colorString as HslaColor;
// Workaround as hue isn't correct after changing hue slider, but Colord parse hue value as zero when color is black.
if (hslaColor && hslaColor.h) {
this.hue = hslaColor.h;
}
this._colord = colord;
...
}
Hue value from HslaColor object is e.g. 191, but after parsing in to Colord instance and use toHsl() it returns a hue of 0.
I added a workaround if the parameter is an HslaColor object and then use in this h property instead, which has the value 191.

We have something like this in a color picker wheere hue value is changed from a hue slider:
Inside
setColor()function:Hue value from
HslaColorobject is e.g. 191, but after parsing in toColordinstance and usetoHsl()it returns a hue of0.I added a workaround if the parameter is an
HslaColorobject and then use in thishproperty instead, which has the value191.