# BackgroundScope

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+class:androidx.compose.foundation.style.BackgroundScope) Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0) Common/All
- Cmn

  ```
  @ExperimentalFoundationStyleApi
  interface BackgroundScope
  ```
Known direct subclasses [DrawStyleScope](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/DrawStyleScope)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/DrawStyleScope` | An interface that introduces the drawing property to a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` receiver scope. |

Known indirect subclasses [StyleScope](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` | A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` is the receiver scope of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` lambda. |

*** ** * ** ***

An interface that introduces the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/BackgroundScope#background(androidx.compose.ui.graphics.Color)` property to a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` receiver scope.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` |   |

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/BackgroundScope#background(androidx.compose.ui.graphics.Color)(color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)` Sets the background color of the component. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/BackgroundScope#background(androidx.compose.ui.graphics.Brush)(value: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush)` Sets the background of the component using a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush`. | Cmn |

## Public functions

### background

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0)

```
fun background(color: Color): Unit
```

Sets the background color of the component. If a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ShapeScope#shape(androidx.compose.ui.graphics.Shape)` is applied, the background will fill that shape.

Setting a background color will override any previously set background brush.

This property is *not* inherited

| Parameters |
|---|---|
| `color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | The background color. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ShapeScope#shape(androidx.compose.ui.graphics.Shape)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/background.modifier#(androidx.compose.ui.Modifier).background(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Shape)` |   |

### background

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0)

```
fun background(value: Brush): Unit
```

Sets the background of the component using a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush`. This allows for gradient backgrounds or other complex fills. If a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ShapeScope#shape(androidx.compose.ui.graphics.Shape)` is applied, the background will fill that shape.

Setting a background brush will override any previously set background color.

This property is *not* inherited

| Parameters |
|---|---|
| `value: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Brush` | The brush to use for the background. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ShapeScope#shape(androidx.compose.ui.graphics.Shape)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/background.modifier#(androidx.compose.ui.Modifier).background(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Shape)` |   |