Skip to main content

Function: isCmykColor()

isCmykColor(value): value is CMYK

Defined in: functions/isCmykColor.ts:27

Checks if a value is a valid CMYK color object.

This function checks if the provided value is an object with properties c, m, y, and k that are integers within the specified ranges:

  • c (cyan) should be an integer between 0 and 100
  • m (magenta) should be an integer between 0 and 100
  • y (yellow) should be an integer between 0 and 100
  • k (black) should be an integer between 0 and 100

Parameters

value

any

The value to check.

Returns

value is CMYK

True if the value is a valid CMYK color object, false otherwise.

Examples

isCmykColor({ c: 0, m: 100, y: 100, k: 0 }); // true
isCmykColor({ c: 50, m: 50, y: 50, k: 50 }); // true
isCmykColor({ c: 101, m: 50, y: 50, k: 50 }); // false
isCmykColor("#ff0000"); // false