Skip to content

Basics

When specifying a color property, you can use one of three color spaces: RGB, CMYK and spot color.

The following properties can be set with the function setColor and support all three color spaces:

  • 'backgroundColor/color'
  • 'camera/clearColor'
  • 'dropShadow/color'
  • 'fill/color/value'
  • 'stroke/color'

RGB

RGB is the color space used when rendering a color to a screen. All values of R, G, Bmust be between 0.0 and 1.0

When using RGB, you typically also specify opacity or alpha as a value between 0.0 and 1.0 and is then referred to as RGBA. When a RGB color has an alpha value that is not 1.0, it will be rendered to screen with corresponding transparency.

CMYK

CMYK is the color space used when color printing. All values of C, M, Y, and K must be between 0.0 and 1.0

When using CMYK, you can also specify a tint value between 0.0 and 1.0. When a CMYK color has a tint value that is not 1.0, it will be rendered to screen as if transparent over a white background.

When rendering to screen, CMYK colors are first converted to RGB using a simple mathematical conversion. Currently, the same conversion happens when exporting a scene to a PDF file.

Spot Color

Spot colors are typically used for special printers or other devices that understand how to use them. Spot colors are defined primarily by their name as that is the information that the device will use to render.

For the purpose of rendering a spot color to screen, it must be given either an RGB or CMYK color approximation or both. These approximations adhere to the same restrictions respectively described above. You can specify a tint as a value between 0.0 and 1.0 which will be interpreted as opacity when rendering to screen. It is up to the special printer or device how to interpret the tint value. You can also specify an external reference, a string describing the origin of this spot color.

When rendering to screen, the spot color’s RGB or CMYK approximation will be used, in that order of preference. When exporting a scene to a PDF file, spot colors will be saved as a Separation Color Space.

Using a spot color is a two step process:

  1. you define a spot color with its name and color approximation(s) in the spot color registry.
  2. you instantiate a spot color with its name, a tint and an external reference.

The spot color registry allows you to:

  • list the defined spot colors
  • define a new a spot color with a name and its RGB or CMYK approximation
  • re-define an existing spot color’s RGB or CMYK approximation
  • retrieve the RGB or CMYK approximation of an already defined spot color
  • remove a spot color from the list of defined spot colors

Multiple blocks and their properties can refer to the same spot color and each can have a different tint and external reference.

Converting between colors

A utility function convertColorToColorSpace is provided to create a new color from an existing color and a new color space. RGB and CMYK colors can be converted between each other and is done so using a simple mathematical conversion. Spot colors can be converted to RGB and CMYK simply by using the corresponding approximation. RGB and CMYK colors cannot be converted to spot colors.

Custom Color Libraries

You can configure CE.SDK with custom color libraries. More information is found here.