How to use the color-convert.cmyk function in color-convert

To help you get started, we’ve selected a few color-convert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Zefau / ioBroker.hue-extended / hue-extended.js View on Github external
let lights = appliance.type == 'lights' ? [appliance.uid] : DEVICES['groups'][appliance.uid].lights;
			
			// handle color spaces
			let value = commands[action];
			let rgb = null, hsv = null;
			if (action == 'rgb')
			{
				rgb = value.split(',');
				hsv = _color.rgb.hsv(rgb);
			}
			
			else if (action == 'hsv')
				hsv = value.split(',');
			
			else if (action == 'cmyk')
				hsv = _color.cmyk.hsv(value.split(','));
			
			else if (action == 'xyz')
				hsv = _color.xyz.hsv(value.split(','));
			
			else if (action == 'hex')
				hsv = _color.hex.hsv(value.split(','));
			
			if (hsv !== null)
			{
				delete commands[action];
				commands = {
					'hue': hsv[0],
					'sat': Math.max(Math.min(Math.round(hsv[1]*2.54), 254), 0),
					'bri': Math.max(Math.min(Math.round(hsv[2]*2.54), 254), 0),
					...commands
				};