rememberPainterThemeColor

fun rememberPainterThemeColor(painter: Painter, fallback: Color, filter: Boolean = true, cacheSize: Int = DEFAULT_CACHE_SIZE, coroutineContext: CoroutineContext = Dispatchers.Default, builder: Palette.Builder.() -> Unit = {}): Color

Create and remember the most suitable color for a UI theme in what painter draws.

The painter is drawn into an image at its intrinsic size, so give it one. Everything else matches rememberThemeColor.

Return

The most suitable color for a UI theme, or fallback until there is one.

Parameters

painter

The Painter to draw and read colors from.

fallback

color to be returned if no other options available.

filter

whether to filter out undesirable combinations.

cacheSize

The maximum number of palettes to cache. If 0, no caching will be done.

coroutineContext

The CoroutineContext to generate the palette on.

builder

A lambda applied to the Palette.Builder to customize the generation.