score

fun score(colorsToPopulation: Map<Int, Int>, desired: Int = 4, fallbackColorArgb: Int? = -0xbd7a0c, filter: Boolean = true): List<Int>

Given a map with keys of colors and values of how often the color appears, rank the colors based on suitability for being used for a UI theme.

Return

Colors sorted by suitability for a UI theme. The most suitable color is the first item, the least suitable is the last. There will always be at least one color returned. If all the input colors were not suitable for a theme, a default fallback color will be provided, Google Blue.

Parameters

colorsToPopulation

map with keys of colors and values of how often the color appears, usually from a source image.

desired

max count of colors to be returned in the list.

fallbackColorArgb

color to be returned if no other options available.

filter

whether to filter out undesirable combinations.