If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Course: Unlisted resources area > Unit 2

Lesson 1: ProcessingJS documentation

blendColor(c1, c2, MODE)

Blends two color values together based on the blending mode given as the MODE parameter.
Parameters:
NameDescription
c1The first color to blend
c2The second color to blend
MODEEither BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, or BURN.
How the modes work:
Modes:
NameDescription
BLENDLinear interpolation of colors: C=A×factor+B
ADDAdditive blending with white clip: C=min(A×factor+B,255)
SUBTRACTSubtractive blending with black clip: C=max(BA×factor,0)
DARKESTOnly the darkest color succeeds: C=min(A×factor,B)
LIGHTESTOnly the lightest color succeeds: C=max(A×factor,B)
DIFFERENCESubtract colors from underlying image.
EXCLUSIONSimilar to DIFFERENCE, but less extreme.
MULTIPLYMultiply the colors, result will always be darker.
SCREENOpposite multiply, uses inverse values of the colors.
OVERLAYA mix of MULTIPLY and SCREEN. Multiplies dark values, and screens light values.
HARD_LIGHTSCREEN when greater than 50% gray, MULTIPLY when lower.
SOFT_LIGHTMix of DARKEST and LIGHTEST. Works like OVERLAY, but not as harsh.
DODGELightens light tones and increases contrast, ignores darks. Called "Color Dodge" in Illustrator and Photoshop.
BURNDarker areas are applied, increasing contrast, ignores lights. Called "Color Burn" in Illustrator and Photoshop.

Want to join the conversation?