---
title: "compositeOver"
description: "Composites [this] color on top of [background] using the Porter-Duff 'source over' mode.

Both [this] and [background] must not be pre-multiplied, and the resulting color will also not be
pre-multiplied.

The [ColorSpace] of the result is always the [ColorSpace][Color.colorSpace] of [background]."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun Color.compositeOver(background: Color): Color
```


Composites `this` color on top of `background` using the Porter-Duff 'source over' mode.

Both `this` and `background` must not be pre-multiplied, and the resulting color will also not be
pre-multiplied.

The `ColorSpace` of the result is always the `ColorSpace` of `background`.

#### Returns

| | |
| --- | --- |
|  | the `Color` representing `this` composited on top of `background`, converted to the color space of `background`. |




