# contentColorFor

## Functions summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/tv/material3/contentColorFor.composable#contentColorFor(androidx.compose.ui.graphics.Color)(backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)` The Material color system contains pairs of colors that are typically used for the background and content color inside a component. |

## Functions

### contentColorFor

Artifact: [androidx.tv:tv-material](https://developer.android.com/jetpack/androidx/releases/tv) [View Source](https://cs.android.com/search?q=file:androidx/tv/material3/ColorScheme.kt+function:contentColorFor) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/tv#1.1.0)

```
@Composable
fun contentColorFor(backgroundColor: Color): Color
```

The Material color system contains pairs of colors that are typically used for the background and content color inside a component. For example, a Button typically uses `primary` for its background, and `onPrimary` for the color of its content (usually text or iconography).

This function tries to match the provided `https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#contentColorFor(androidx.compose.ui.graphics.Color)` to a 'background' color in this `https://developer.android.com/reference/kotlin/androidx/tv/material3/ColorScheme`, and then will return the corresponding color used for content. For example, when `https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#contentColorFor(androidx.compose.ui.graphics.Color)` is `https://developer.android.com/reference/kotlin/androidx/tv/material3/ColorScheme#primary()`, this will return `https://developer.android.com/reference/kotlin/androidx/tv/material3/ColorScheme#onPrimary()`.

If `https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#contentColorFor(androidx.compose.ui.graphics.Color)` does not match a background color in the theme, this will return the current value of `https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#LocalContentColor()` as a best-effort color.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | the matching content color for `https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#contentColorFor(androidx.compose.ui.graphics.Color)`. If `https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#contentColorFor(androidx.compose.ui.graphics.Color)` is not present in the theme's `https://developer.android.com/reference/kotlin/androidx/tv/material3/ColorScheme`, then returns the current value of `https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#LocalContentColor()`. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#(androidx.tv.material3.ColorScheme).contentColorFor(androidx.compose.ui.graphics.Color)` |   |