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)"

RGBA

Use the 8 character hexadecimal value following a hash prefix. Or wrap the 3 RGB values plus the opacity percentage (between 0 and 1) comma separated in rgba().

  • "#efefef80"
  • "rgba(23,45,128,0.5)"

CMYK

Wrap the 4 CMYK values comma separated in cmyk(). Each value should be an integer >= 0 and <= 100. Optionally use cmyka() and append a 5th value representing an opacity percentage (between 0 and 1)

  • "cmyk(0,0,0,0)"
  • "cmyk(34,96,13,85)"
  • "cmyka(42,3,54,8,0.5)

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. Optionally append a 6th value representing an opacity percentage (between 0 and 1) and a 7th value representing the tint (between 0 and 1)

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

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"