core-ktx / / / plus


operator fun Color): Color

Composites two translucent colors together. More specifically, adds two colors using the source over blending mode. The colors must not be pre-multiplied and the result is a non pre-multiplied color.

If the two colors have different color spaces, the color in the right-hand part of the expression is converted to the color space of the color in left-hand part of the expression.

The following example creates a purple color by blending opaque blue with semi-translucent red:

val purple = Color.valueOf(0f, 0f, 1f) + Color.valueOf(1f, 0f, 0f, 0.5f)


IllegalArgumentException - if the color models of the colors do not match