comet.CColor

class comet.CColor

See also

Module color

Methods

CColor.getModel()

Get the color model.

Returns:

The color model.

One of Color models

Return type:

int

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CColor.getValues()

Get the color values.

Returns:

The color values.

The return type depends on the color model obtained by getModel():

Return type:

float | tuple[int, int, int] | tuple[float, float, float, float] | tuple[float, int, int]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CColor.setGray(value)

the color type to gray and set the value.

Parameters:

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

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CColor.setRGB(R, G, B)

Set the color type to RGB and set the values.

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

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

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

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CColor.setCMYK(C, M, Y, K)

Set the color type to CMYK and set the values.

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

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

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

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

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CColor.setLAB(L, A, B)

Set the color type to LAB and set the values.

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

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

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

Raises:
Available:

InDesign® comet_pdf® Illustrator®

Special methods

CColor.__repr__()

String representation.

Returns:

For getModel() == constants.kColorModelRGB :

<CColor> Type: RGB | R: Red | G: Green | B: Blue

For getModel() == constants.kColorModelCMYK :

<CColor> Type: CMYK | C: C | M: M | Y: Y | K: K

For getModel() == constants.kColorModelLAB :

<CColor> Type: LAB | L: L | A: A | B: B

For getModel() == constants.kColorModelGray :

<CColor> Gray: LAB | Gray value

Examples
<CColor> RGB | R: 10 | G: 20 | B: 30

<CColor> CMYK | C: 0.30 | M: 0.40 | Y: 0.50 | K: 0.60

<CColor> LAB | L: 20.00 | A: 30 | B: 40

<CColor> Gray | 0.50

Return type:

str