Skip to content

Commit 8ce42c9

Browse files
Welander1994iOvergaard
authored andcommitted
fixes the color-picker-handles placement, after selecting a preset value
1 parent e5413a8 commit 8ce42c9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/uui-color-area/lib/uui-color-area.element.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ export class UUIColorAreaElement extends LitElement {
115115
const parsed = colord(newVal);
116116

117117
if (parsed.isValid()) {
118-
const { h, l, a } = parsed.toHsl();
118+
const { h, s, l, a } = parsed.toHsl();
119119

120120
// Update hue from parsed color, but when color is black, value from hue slider may be different from zero.
121121
if (h !== 0) {
122122
this.hue = h;
123123
}
124124

125125
this.lightness = l;
126+
this.saturation = s;
126127
this.brightness = this.getBrightness(l);
127128
this.alpha = a * 100;
128129
}
@@ -210,9 +211,8 @@ export class UUIColorAreaElement extends LitElement {
210211
l: this.lightness,
211212
a: this.alpha / 100,
212213
});
213-
214+
console.log(this.saturation);
214215
this._value = color.toRgbString();
215-
216216
this.dispatchEvent(new UUIColorAreaEvent(UUIColorAreaEvent.CHANGE));
217217
}
218218

@@ -226,10 +226,13 @@ export class UUIColorAreaElement extends LitElement {
226226
const color = colord(
227227
`hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha / 100})`,
228228
);
229+
230+
console.log(`hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha / 100})`);
231+
229232
if (!color.isValid()) {
230233
return '';
231234
}
232-
235+
console.log(color.toHex());
233236
return color.toHex();
234237
}
235238

0 commit comments

Comments
 (0)