Colors

Color Blend

blendMode(operation)

Set a blend mode.

Available operations are: normal, multiply, screen, overlay, darken, lighten, colorDodge, colorBurn, softLight, hardLight, difference, exclusion, hue, saturation, color, luminosity, clear, copy, sourceIn, sourceOut, sourceAtop, destinationOver, destinationIn, destinationOut, destinationAtop, xOR, plusDarker and plusLighter,

# set a blend mode
blendMode("multiply")

# set a color
cmykFill(1, 0, 0, 0)
# draw a rectangle
rect(10, 10, 100, 100)
# set an other color
cmykFill(0, 1, 0, 0)
# overlap a second rectangle
rect(60, 60, 100, 100)

Color Spaces

Set a colorSpace before setting a color. Color spaces are only aviable for RGB colors.

colorSpace(colorSpace)

Set the color space. Options are genericRGB, adobeRGB1998, sRGB, genericGray, genericGamma22Gray. The default is genericRGB. None will reset it back to the default.

# set a color
r, g, b, a = 0.74, 0.51, 1.04, 1

# get all available color spaces
colorSpaces = listColorSpaces()

x = 0
w = width() / len(colorSpaces)

# start loop
for space in colorSpaces:

    # set a color space
    colorSpace(space)
    # set the color
    fill(r, g, b)
    # draw a rect
    rect(x, 0, w, height())
    x += w
listColorSpaces()

Return a list of all available color spaces.