comet.CSwatch¶
- class comet.CSwatch¶
Methods¶
- CSwatch.getDocument() CDocument¶
Returns the document this swatch belongs to.
- Returns:
The owning document
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CSwatch.getName() str¶
Get the swatch name.
The name is not translated and uses the internal host application name.
- Returns:
The swatch name
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CSwatch.getModel() int¶
Get the color model of this swatch if it is a basic color.
- Returns:
The color model.
One of Color models.
Returns
constants.kColorModelUnknownwhen the color is not a basic color.- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CSwatch.getSpace() int¶
Get the swatch definition space.
- Returns:
The swatch definition space.
One of Swatch spaces
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CSwatch.getType() int¶
Get the type of this swatch.
- Returns:
The swatch type.
One of Swatch types
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CSwatch.getTint() float¶
Get the tint of this swatch.
- Returns:
The swatch tint
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CSwatch.isSpot() bool¶
Get whether this swatch is a spot color.
- Returns:
Whether the swatch is a spot color
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CSwatch.isLocked() bool¶
Get whether this swatch is locked.
- Returns:
Whether the swatch is locked
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CSwatch.isReserved() bool¶
Get whether this swatch is reserved by the host application.
- Returns:
Whether the swatch is reserved
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- CScript:
- CSwatch.getColor() CColor | None¶
Get the color of the swatch.
- Returns:
The swatch color.
The return type depends on the swatch color model obtained by
getModel():- Return type:
CColor | None
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CSwatch.getColors() float | tuple[int, int, int] | tuple[float, float, float, float] | tuple[float, int, int] | None¶
Get the color values of the swatch.
- Returns:
The color values.
The return type depends on the swatch color model:
constants.kColorModelGray:Gray value
float in range[0.0, 1.0]
constants.kColorModelRGB:-
Red, green, blue values in range[0, 255]
constants.kColorModelLAB:-
L, A, B values in range: L[0.0, 100.0], A[-127, 128], B[-127, 128]
- Return type:
tuple[int, int, int] | tuple[float, float, float, float] | tuple[float, int, int] | None
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CSwatch.redefine(color: CColor | tuple[int, int, int] | tuple[float, float, float, float] | tuple[float, int, int], type: int = 1) None¶
Change the definition of this swatch.
Type must be
constants.kSwatchTypeBaseColor. Please take care not to change reserved swatches. This may cause serious errors!- Parameters:
color –
The color values and target color space.
The parameter type can be:
CColorA color.
Illustrator® When the swatch is a process color, all values always get converted into the document color space.
LAB colors are only supported for global swatches.
type (int) –
The color type
0: Spot
1: Process
Illustrator® Ignored.
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
When parameter colors contains invalid values for the required space
When parameter type has invalid value
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- CSwatch.remove() None¶
Deletes this swatch from its document. All subsequent calls to this swatches functions will fail.
- Returns:
None
- Raises:
CometError – On internal error
- Available:
InDesign® Illustrator®