rememberResourcesDominantColorState

fun rememberResourcesDominantColorState(defaultColor: Color, defaultOnColor: Color, cacheSize: Int = DominantColorState.DEFAULT_CACHE_SIZE, coroutineContext: CoroutineContext = Dispatchers.Default, isSwatchValid: (Palette.Swatch) -> Boolean = { true }, builder: Palette.Builder.() -> Unit = {}): DominantColorState<Resource>

Wrapper around rememberDominantColorState that uses ResourceLoader to load the image.

Return

A DominantColorState which can be used to generate a dominant color from a ImageBitmap.

Parameters

defaultColor

The default color, which will be used if Palette.generate fails.

defaultOnColor

The default color to use on defaultColor.

cacheSize

The size of the LruCache used to store recent results. Pass 0 to disable.

coroutineContext

The CoroutineContext used to launch the coroutine.

isSwatchValid

A lambda which allows filtering of the calculated Palette.Swatch.

builder

A lambda which allows customization of the Palette.Builder used to generate the Palette.

See also