Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var kelvin = +match[1];
var ct = mired.kelvinToMired(kelvin);
state.ct = Math.round(ct);
} else if (command === 'state') {
state = JSON.parse(fs.readFileSync('/dev/stdin', 'utf8'));
} else {
var hex = csscolors[command];
if (!hex) {
match = command.match(/^#?(([0-9A-Fa-f]{3})|([0-9A-Fa-f]{6}))$/);
if (!match)
return new Error('failed to parse command');
hex = match[1];
}
var rgb = hex2rgb(hex);
var hsl = rgb2hsl(rgb);
state.hue = Math.round(hsl[0] / 360 * 65535);
state.sat = Math.round(hsl[1] / 100 * 254);
state.bri = Math.round(hsl[2] / 100 * 254);
}
// parse extra options to merge into the state object
var extraOpts;
try {
extraOpts = kvToObj(args, {autocast: true});
} catch (e) {
return e;
}
return deepmerge(state, extraOpts);
}
get() {
return colorConvert.rgb2hsl(this.rgb);
},
set(value) {