Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function color2hwb(color) {
const [ hue, whiteness, blackness ] = color.colorspace === 'rgb'
? rgb2hwb(color.red, color.green, color.blue, color.hue)
: color.colorspace === 'hsl'
? hsl2hwb(color.hue, color.saturation, color.lightness)
: [ color.hue, color.whiteness, color.blackness ];
return { hue, whiteness, blackness, alpha: color.alpha, colorspace: 'hwb' };
}