Color Blending Functions
These operations are similar (though not necessarily identical) to the blend modes found in image editors like Photoshop, Fireworks, or GIMP, so you can use them to make your CSS colors match your images.
Example:
multiply#
Multiply two colors. Corresponding RGB channels from each of the two colors are multiplied together then divided by 255. The result is a darker color.
Parameters:
color1: A color object.color2: A color object.
Returns: color
Examples:
screen#
Do the opposite of
multiply. The result is a brighter color.
Parameters:
color1: A color object.color2: A color object.
Returns: color
Example:
overlay#
Combines the effects of both
multiplyandscreen. Conditionally make light channels lighter and dark channels darker. Note: The results of the conditions are determined by the first color parameter.
Parameters:
color1: A base color object. Also the determinant color to make the result lighter or darker.color2: A color object to overlay.
Returns: color
Example:
softlight#
Similar to
overlaybut avoids pure black resulting in pure black, and pure white resulting in pure white.
Parameters:
color1: A color object to soft light another.color2: A color object to be soft lighten.
Returns: color
Example:
hardlight#
The same as
overlaybut with the color roles reversed.
Parameters:
color1: A color object to overlay.color2: A base color object. Also the determinant color to make the result lighter or darker.
Returns: color
Example:
difference#
Subtracts the second color from the first color on a channel-by-channel basis. Negative values are inverted. Subtracting black results in no change; subtracting white results in color inversion.
Parameters:
color1: A color object to act as the minuend.color2: A color object to act as the subtrahend.
Returns: color
Example:
exclusion#
A similar effect to
differencewith lower contrast.
Parameters:
color1: A color object to act as the minuend.color2: A color object to act as the subtrahend.
Returns: color
Example:
average#
Compute the average of two colors on a per-channel (RGB) basis.
Parameters:
color1: A color object.color2: A color object.
Returns: color
Example:
negation#
Do the opposite effect to
difference.
The result is a brighter color. Note: The opposite effect doesn't mean the inverted effect as resulting from an addition operation.
Parameters:
color1: A color object to act as the minuend.color2: A color object to act as the subtrahend.
Returns: color
Example: