Tutorial: Colors

Colors

Formatting Color Values

All color values are returned as strings and expected as string inputs.

RGB

Use the 6 character hexadecimal value following a hash prefix. Or wrap the 3 RGB values comma separated in rgb() with each value an integer >= 0 and <= 255.

  • "#efefef"
  • "rgb(23,45,128)"

CMYK

Wrap the 4 CMYK values comma separated in cmyk(). Each value should be an integer >= 0 and <= 100.

  • "cmyk(0,0,0,0)"
  • "cmyk(34,96,13,85)"

SPOT

Wrap the double quote enclosed SPOT color name (e.g. Pantone name) followed by its 4 CMYK fallback values comma separated in spot(). Each CMYK fallback value should be an integer >= 0 and <= 100.

  • 'spot("PMS 123 C",0,100,91,0)'
  • 'spot("PMS 485 C",0,30,94,0)'

Transparent

Use the special transparent value to specify no fill or no stroke

  • "transparent"

Gradients

Gradients are not possible to set programmatically yet, but are identified in element data using the special gradient value

  • "gradient"