*
* @since 5.5
*/
- getColor() {
- const color = this.colorInput.value;
- const alpha = this.alphaInput.value;
- return { ...ColorUtil.hexToRgb(color), a: +alpha };
+ getColor(source) {
+ const a = parseFloat(this.channels.get("a" /* A */).value);
+ if (source === "hsl" /* HSL */) {
+ const rgb = ColorUtil.hslToRgb(parseInt(this.hsl.get("hue" /* Hue */).value, 10), parseInt(this.hsl.get("saturation" /* Saturation */).value, 10), parseInt(this.hsl.get("lightness" /* Lightness */).value, 10));
- return Object.assign(Object.assign({}, rgb), { a });
++ return {
++ ...rgb,
++ a,
++ };
+ }
+ return {
+ r: parseInt(this.channels.get("r" /* R */).value, 10),
+ g: parseInt(this.channels.get("g" /* G */).value, 10),
+ b: parseInt(this.channels.get("b" /* B */).value, 10),
+ a,
+ };
}
/**
* Opens the color picker after clicking on the picker button.