comet.color

The comet.color module provides access to a documents swatches and color settings.

Methods

comet.color.createGray(value: float = 0.0) CColor

Create a CColor object with a gray value.

Parameters:

value (float) – The gray value in range[0.0, 1.0]

Returns:

The newly created color

Return type:

CColor

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameters are out of range

Available:

InDesign® comet_pdf® Illustrator®

Examples:

Create a 50% gray color.

gray = comet.color.createGray(0.5)
comet.color.createRGB(R: int = 0, G: int = 0, B: int = 0) CColor

Create a CColor object with RGB values.

Parameters:
  • R (int) – The red value in range[0, 255]

  • G (int) – The green value in range[0, 255]

  • B (int) – The blue value in range[0, 255]

Returns:

The newly created color

Return type:

CColor

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameters are out of range

Available:

InDesign® comet_pdf® Illustrator®

Examples:

Create a red RGB color.

red = comet.color.createRGB(255, 0, 0)

Create a purple RGB color.

purple = comet.color.createRGB(161, 52, 235)
comet.color.createCMYK(C: float = 0.0, M: float = 0.0, Y: float = 0.0, K: float = 0.0) CColor

Create a CColor object with CMYK values.

Parameters:
  • C (float) – The C value in range[0.0, 1.0]

  • M (float) – The M value in range[0.0, 1.0]

  • Y (float) – The Y value in range[0.0, 1.0]

  • K (float) – The K value in range[0.0, 1.0]

Returns:

The newly created color

Return type:

CColor

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameters are out of range

Available:

InDesign® comet_pdf® Illustrator®

Examples:

Create a green CMYK color.

green = comet.color.createCMYK(0.8, 0.0, 1.0, 0.0)

Create an orange CMYK color.

orange = comet.color.createCMYK(0.0, 0.35, 0.80, 0.0)
comet.color.createLAB(L: float = 0.0, A: int = 0, B: int = 0) CColor

Create a CColor object with LAB values.

Parameters:
  • L (float) – The L value in range[0.0, 100.0]

  • A (int) – The A value in range[-127, 128]

  • B (int) – The B value in range[-127, 128]

Returns:

The newly created color

Return type:

CColor

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameters are out of range

Available:

InDesign® comet_pdf® Illustrator®

Examples:

Create an orange LAB color.

orange = comet.color.createCMYK(76.0, 27, 66)