themeColorOrNull

fun Palette.themeColorOrNull(filter: Boolean = true): Color?

Determine the most suitable swatch of this Palette for a UI theme, or null.

Use this when you would rather show nothing than show a color the image did not really contain.

Receiver

the Palette whose swatches are scored.

Return

The most suitable color for a UI theme, or null if no suitable color was found.

Parameters

filter

whether to filter out undesirable combinations.


fun PaletteState<*>.themeColorOrNull(filter: Boolean = true): Color?

The scored seed color of the last successful generation of this PaletteState.

Reading this in a composition subscribes to the state, so the composition runs again when the generation finishes.

Receiver

the PaletteState to read.

Return

The most suitable color for a UI theme, or null while loading, after an error, or when no swatch suits a theme.

Parameters

filter

whether to filter out undesirable combinations.


fun DominantColorState<*>.themeColorOrNull(filter: Boolean = true): Color?

The scored seed color of the last successful update of this DominantColorState.

DominantColorState already hands you color and onColor, which are the highest population swatch it found. This is the scored view of the same result, so it is the color a theme would be seeded with rather than the color that covers the most pixels.

Receiver

the DominantColorState to read.

Return

The most suitable color for a UI theme, or null while loading, after an error, or when no swatch suits a theme.

Parameters

filter

whether to filter out undesirable combinations.