Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created August 13, 2021 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skydoves/1d28241bd6c468cc3507a44bfc7d5a25 to your computer and use it in GitHub Desktop.
Save skydoves/1d28241bd6c468cc3507a44bfc7d5a25 to your computer and use it in GitHub Desktop.
Palette
var palette by remember { mutableStateOf<Palette?>(null) }
GlideImage( // CoilImage, FrescoImage also can be used.
imageModel = poster?.poster!!,
bitmapPalette = BitmapPalette {
palette = it
}
)
Crossfade(
targetState = palette,
modifier = Modifier
.padding(horizontal = 8.dp)
.size(45.dp)
) {
Box(
modifier = Modifier
.background(color = Color(it?.lightVibrantSwatch?.rgb ?: 0))
.fillMaxSize()
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment