Composables
Components Unstyled Icons API
Join Radar
Join Radar Components Unstyled Icons API UI Kit UI Blocks SVG to Compose Android Distribution Community Docs Blog Colors
Components
  • Button
  • Card
  • GlimmerTheme
  • Icon
  • IconButton
  • ListItem
  • Text
  • TitleChip
  • VerticalList
  • VerticalStack
Composable Functions
  • rememberListState
  • rememberStackState
  • surface
Modifiers
  • contentColorProvider
  • depthEffect
  • onIndirectPointerGesture
  • surface
Classes
  • ButtonSize
  • Colors
  • ComponentSpacingValues
  • DepthEffect
  • DepthEffectLevels
  • GlimmerTheme
  • IconSizes
  • ListScopeMarker
  • ListState
  • Shapes
  • StackState
  • SurfaceDepthEffect
  • Typography
Objects
  • ButtonDefaults
  • CardDefaults
  • ListItemDefaults
  • SurfaceDefaults
  • TitleChipDefaults
  • TypographyDefaults
  • VerticalListDefaults
Interfaces
  • LazyListItemInfo
  • ListItemScope
  • ListLayoutInfo
  • ListScope
  • StackItemScope
  • StackScope
Properties
  • LocalIconSize
  • LocalTextStyle
Functions
  • calculateContentColor
  • items
  • itemsIndexed
  • SnapLayoutInfoProvider
Jetpack Compose / XR Glimmer / Glimmer / Functions / calculateContentColor
Function

calculateContentColor

View Markdown Open in ChatGPT Open in Claude

Calculates the preferred content color for backgroundColor.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

calculateContentColor

Android
public fun calculateContentColor(backgroundColor: Color): Color

Calculates the preferred content color for backgroundColor. This will return either Color.White or Color.Black, depending on the luminance of the background color.

LocalTextStyle ← Previous items Next →
On this page
  • calculateContentColor

Never miss a Compose release

Get an alert the moment a new Compose release is out: new APIs, new components, new things to experiment with. Straight from Google's servers.

Join 3,000+ Compose developers. No spam, ever.