ContentColorKt

Added in 1.0.0-alpha01

public final class ContentColorKt


Summary

Public methods

static final @NonNull Color

Calculates the preferred content color for backgroundColor.

static final @NonNull Modifier
contentColorProvider(
    @NonNull Modifier receiver,
    @NonNull Color contentColor
)

Provides contentColor for text and iconography to consume.

Public methods

calculateContentColor

public static final @NonNull Color calculateContentColor(@NonNull Color backgroundColor)

Calculates the preferred content color for backgroundColor. This will return either Color.White or Color.Black, depending on the luminance of the background color.

contentColorProvider

public static final @NonNull Modifier contentColorProvider(
    @NonNull Modifier receiver,
    @NonNull Color contentColor
)

Provides contentColor for text and iconography to consume. Content color is provided automatically by surface - contentColorProvider can be used for cases where some text or icons inside a surface require a different color for emphasis.

Parameters
@NonNull Color contentColor

the content color to provide for descendants