ColorCMYK

class ColorCMYK(*args)

Bases: Color

Create a CMYK color by passing cyan, magenta, yellow, key and optionally, alpha. All parameters are between 0-1.

Convert another color object to CMYK by passing it as a parameter.

Raises
  • TypeError – CMYK, alpha values must be floats

  • ValueError – CMYK, alpha values must be between 0-1

Examples

>>> ColorCMYK(0.5, 0.4, 0.2, 0.1)
ColorCMYK(0.5, 0.4, 0.2, 0.1)
>>> ColorCMYK(0.6, 0.9, 1, 1, 0.5)
ColorCMYK(0.6, 0.9, 1, 1)
>>> ColorCMYK(other_color)
property cyan: float
property magenta: float
property yellow: float
property key: float
property red: int
property green: int
property blue: int
property alpha: float
__add__(other: Union[int, Color]) Color

Adds an integer value to the RGB components of the color, or adds the RGB components of another color supplied. You can also use in-place addition.

Examples

>>> Color(120, 50, 60) + 5  # increases the brightness by 5 points
Color(125, 55, 65)
>>> Color(15, 20, 30) + Color(60, 5, 30)
Color(75, 25, 60)
Return type

Color

__sub__(other: Union[int, Color]) Color

Subtracts an integer value from the RGB components of the color, or subtracts the RGB components of another color supplied. You can also use in-place subtraction.

Examples

>>> Color(120, 50, 60) - 5  # decreases the brightness by 5 points
Color(115, 45, 55)
>>> Color(60, 80, 100) - Color(10, 20, 30)
Color(50, 60, 70)
Return type

Color