Skip to content

Commit 84a42f8

Browse files
Convert the new color to the current color space
1 parent b535d4d commit 84a42f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/color-scale/color-scale.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const Self = class ColorScale extends ColorElement {
8181

8282
addButton.addEventListener("click", evt => {
8383
let {name, color} = this.defaultColor?.() ?? {};
84-
[name, color] = [name ?? "New color", color ?? this.computedColors.at(-1)?.color ?? new Self.Color("#f06").to(this.space)];
84+
[name, color] = [name ?? "New color", color ?? this.computedColors.at(-1)?.color ?? new Self.Color("#f06")];
8585

8686
if (this.colors[name]) {
8787
// Name already exists
@@ -93,7 +93,7 @@ const Self = class ColorScale extends ColorElement {
9393
name = `${ name } ${ i }`;
9494
}
9595

96-
this.colors = {...this.colors, [name]: color};
96+
this.colors = {...this.colors, [name]: color.to(this.space)};
9797
this.render();
9898

9999
// Focus the new color input and select its content

0 commit comments

Comments
 (0)