Spot Colors
In this example, we will show you how to use the CreativeEditor SDK's CreativeEngine to manage spot colors in the editor
API.
Setup#
This example uses the headless CreativeEngine. See the Setup article for a detailed guide.
To get started right away, you can also access the block
API within a running CE.SDK instance via cesdk.engine.block
.
Check out the APIs Overview to see that illustrated in more detail.
Functions#
findAllSpotColors(): string[]
Queries the names of currently set spot colors previously set with setSpotColorRGB
.
- Returns The names of set spot colors.
getSpotColorRGBA(name: string): RGBA
Queries the RGB representation set for a spot color. If the value of the queried spot color has not been set yet, returns the default RGB representation (of magenta). The alpha value is always 1.0.
name
: The name of a spot color.- Returns A result holding a float array of the four color components.
getSpotColorCMYK(name: string): CMYK
Queries the CMYK representation set for a spot color. If the value of the queried spot color has not been set yet, returns the default CMYK representation (of magenta).
name
: The name of a spot color.- Returns A result holding a float array of the four color components.
setSpotColorRGB(name: string, r: number, g: number, b: number): void
Sets the RGB representation of a spot color. Use this function to both create a new spot color or update an existing spot color.
name
: The name of a spot color.r
: The red color component in the range of 0 to 1.g
: The green color component in the range of 0 to 1.b
: The blue color component in the range of 0 to 1.
setSpotColorCMYK(name: string, c: number, m: number, y: number, k: number): void
Sets the CMYK representation of a spot color. Use this function to both create a new spot color or update an existing spot color.
name
: The name of a spot color.c
: The cyan color component in the range of 0 to 1.m
: The magenta color component in the range of 0 to 1.y
: The yellow color component in the range of 0 to 1.k
: The key color component in the range of 0 to 1.
removeSpotColor(name: string): void
Removes a spot color from the list of set spot colors.
name
: The name of a spot color.- Returns An empty result on success, an error otherwise.