We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6460130 commit 4ab54f6Copy full SHA for 4ab54f6
lib/color.js
@@ -4,6 +4,16 @@ export default class Color {
4
constructor(color) {
5
this.color = Object(Object(color).color || color);
6
7
+ this.color.colorspace = this.color.colorspace
8
+ ? this.color.colorspace
9
+ : 'red' in color && 'green' in color && 'blue' in color
10
+ ? 'rgb'
11
+ : 'hue' in color && 'saturation' in color && 'lightness' in color
12
+ ? 'hsl'
13
+ : 'hue' in color && 'whiteness' in color && 'blackness' in color
14
+ ? 'hwb'
15
+ : 'unknown';
16
+
17
if (color.colorspace === 'rgb') {
18
this.color.hue = rgb2hue(color.red, color.green, color.blue, color.hue || 0);
19
}
0 commit comments