Palette
A helper class to extract prominent colors from an image.
A number of colors with different profiles are extracted from the image:
Vibrant
Vibrant Dark
Vibrant Light
Muted
Muted Dark
Muted Light
These can be retrieved from the appropriate getter method.
Instances are created with a Builder which supports several options to tweak the generated Palette. See that class' documentation for more information.
Generation should always be completed on a background thread, ideally the one in which you load your image on. Builder supports both synchronous and asynchronous generation:
Palette p = Palette.from(bitmap).generate();
Properties
Returns a muted and dark swatch from the palette. Might be null.
Returns a dark and vibrant swatch from the palette. Might be null.
Returns a muted and light swatch from the palette. Might be null.
Returns a light and vibrant swatch from the palette. Might be null.
Returns a muted swatch from the palette. Might be null.
Returns the dominant swatch from the palette.
Returns the most vibrant swatch in the palette. Might be null.
Functions
Returns the selected color for the given target from the palette as an RGB packed int.
Returns a muted and dark color from the palette as an RGB packed int.
Returns a dark and vibrant color from the palette as an RGB packed int.
Returns the color of the dominant swatch from the palette, as an RGB packed int.
Returns a muted and light color from the palette as an RGB packed int.
Returns a light and vibrant color from the palette as an RGB packed int.
Returns a muted color from the palette as an RGB packed int.
Returns the selected swatch for the given target from the palette, or null
if one could not be found.
Returns the most vibrant color in the palette as an RGB packed int.