remember Painter Dominant Color State
fun rememberPainterDominantColorState(defaultColor: Color = MaterialTheme.colorScheme.primary, defaultOnColor: Color = MaterialTheme.colorScheme.onPrimary, density: Density = LocalDensity.current, layoutDirection: LayoutDirection = LocalLayoutDirection.current, cacheSize: Int = 0, coroutineContext: CoroutineContext = Dispatchers.Default, isSwatchValid: (Palette.Swatch) -> Boolean = { true }, builder: Palette.Builder.() -> Unit = {}): DominantColorState<Painter>
Wrapper around rememberDominantColorState that uses PainterLoader to load the image.
Return
A DominantColorState which can be used to generate a dominant color from a Painter.
Parameters
default Color
The default color, which will be used if Palette.generate fails.
default On Color
The default color to use on defaultColor.
density
The Density used for drawing the Painter as ImageBitmap.
layout Direction
The LayoutDirection used for drawing the Painter as ImageBitmap.
cache Size
The size of the LruCache used to store recent results. Pass 0 to disable.
coroutine Context
The CoroutineContext used to launch the coroutine.
is Swatch Valid
A lambda which allows filtering of the calculated Palette.Swatch.
builder
A lambda which allows filtering of the calculated Palette.Builder used to generate the Palette.