themeColor

fun Palette.themeColor(fallback: Color, filter: Boolean = true): Color

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

Receiver

the Palette whose swatches are scored.

Return

The most suitable color for a UI theme, or fallback when no swatch suits one.

Parameters

fallback

color to be returned if no other options available.

filter

whether to filter out undesirable combinations.


fun PaletteState<*>.themeColor(fallback: Color, filter: Boolean = true): Color

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

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 fallback while loading, after an error, or when no swatch suits a theme.

Parameters

fallback

color to be returned if no other options available.

filter

whether to filter out undesirable combinations.