Google is committed to advancing racial equity for Black communities. See how.

Emphasis

@Immutable interface Emphasis
androidx.compose.material.Emphasis

Emphasis allows certain parts of a component to be accentuated, or shown with lower contrast to reflect importance / state inside a component. For example, inside a disabled button, text should have an emphasis level of EmphasisLevels.disabled, to show that the button is currently not active / able to be interacted with.

Emphasis works by adjusting the color provided by AmbientContentColor, so that emphasis levels cascade through a subtree without requiring components to be aware of their context.

The default implementations convey emphasis by changing the alpha / opacity of color, to increase / reduce contrast for a particular element.

To set emphasis for a particular subtree, see ProvideEmphasis.

To define the emphasis levels in your application, see EmphasisLevels and AmbientEmphasisLevels

  • note that this should not typically be customized, as the default values are optimized for accessibility and contrast on different surfaces.

For more information on emphasis and ensuring legibility for content, see Text legibility

Summary

Public methods
abstract Color

Applies emphasis to the given color.

Public methods

applyEmphasis

abstract fun applyEmphasis(color: Color): Color

Applies emphasis to the given color.