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

TextSelectionColors

@Immutable class TextSelectionColors
kotlin.Any
   ↳ androidx.compose.ui.selection.TextSelectionColors

Represents the colors used for text selection by text and text field components.

See AmbientTextSelectionColors to provide new values for this throughout the hierarchy.

Summary

Public constructors
<init>(handleColor: Color, backgroundColor: Color)

Represents the colors used for text selection by text and text field components.

Public methods
Boolean
equals(other: Any?)

Int

String

Properties
Color

the color used to draw the background behind the selected region.

Color

the color used for the selection handles on either side of the selection region.

Public constructors

<init>

TextSelectionColors(
    handleColor: Color,
    backgroundColor: Color)

Represents the colors used for text selection by text and text field components.

See AmbientTextSelectionColors to provide new values for this throughout the hierarchy.

Public methods

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

toString

fun toString(): String

Properties

backgroundColor

val backgroundColor: Color

the color used to draw the background behind the selected region. This color should have alpha applied to keep the text legible - this alpha is typically 0.4f (40%) but this may need to be reduced in order to meet contrast requirements depending on the color used for text, selection background, and the background behind the selection background.

handleColor

val handleColor: Color

the color used for the selection handles on either side of the selection region.