Skip to content

Commit 90f2bcc

Browse files
[color-scale] Experiments with handling complex CSS colors
1 parent ac62f55 commit 90f2bcc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/color-scale/color-scale.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ const Self = class ColorScale extends ColorElement {
8787
is: Object,
8888
// Support overriding the Color object
8989
get values () {
90-
return ColorScale.Color;
90+
class Color extends ColorScale.Color {
91+
constructor (value) {
92+
let color = ColorScale.resolveColor(value, dummy);
93+
super(color);
94+
}
95+
}
96+
return Color;
9197
},
9298
defaultKey: (v, i) => v,
9399
},
@@ -165,3 +171,9 @@ const Self = class ColorScale extends ColorElement {
165171
Self.define();
166172

167173
export default Self;
174+
175+
let dummy;
176+
if (document) {
177+
dummy = document.createElement("div");
178+
document.body.appendChild(dummy);
179+
}

0 commit comments

Comments
 (0)