themeColors

fun ImageBitmap.themeColors(maxColors: Int = MAX_COLORS_DEFAULT, fallbackColor: Color = Color(-0xbd7a0c), filter: Boolean = true, numberOfColors: Int = DESIRED_COLORS_DEFAULT): List<Color>

Ranks colors extracted from an ImageBitmap by their suitability for a UI theme.

Receiver

The ImageBitmap to extract and rank colors from.

Return

A list of colors sorted by their suitability for a UI theme. The list will always contain at least one color.

Parameters

maxColors

The maximum number of colors to extract from the image.

fallbackColor

The color to return if no suitable theme colors are found. Defaults to Google Blue.

filter

Whether to filter out undesirable color combinations.

numberOfColors

Desired number of colors to return.