You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
bjarnef
changed the title
HslaColorHslaColor parsed to zero in hue value
Sep 29, 2023
We have something like this in a color picker wheere hue value is changed from a hue slider:
Inside
setColor()
function:Hue value from
HslaColor
object is e.g. 191, but after parsing in toColord
instance and usetoHsl()
it returns a hue of0
.I added a workaround if the parameter is an
HslaColor
object and then use in thish
property instead, which has the value191
.The text was updated successfully, but these errors were encountered: