Extract Colors with Palette

The Palette library allows us to take an image and pull colors out of it to use within our app. Ever run a music app on your Android device and notice how the window changes color? That’s Palette in action.

Palette analyzes your image and gives you a Palette object with the dominant, vibrant, and muted colors on it. There’s only one dominant color, but the latter two types have normal, light, and dark variants that are included in a Palette. I wrote a sample app that creates a Palette from an image and displays them under the image. When I used the cover of this book on the app, I got something that looked like the image shown.

Pretty cool, right? Well, unless you’re viewing this page in black and white, then you’ll ...

Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.