# TextSelectionColors

# TextSelectionColors

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation)  
[View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/text/selection/TextSelectionColors.kt+class:androidx.compose.foundation.text.selection.TextSelectionColors)  
Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)
Common/AllAndroid/JVM
  - Cmn  

  ```
  class TextSelectionColors
  ```

*** ** * ** ***

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

See [LocalTextSelectionColors](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/selection/package-summary#LocalTextSelectionColors()) to provide new values for this throughout the hierarchy.

## Summary

|                                                                                                                                                                                                                   ### Public constructors                                                                                                                                                                                                                   |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [TextSelectionColors](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/selection/TextSelectionColors#TextSelectionColors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color))`(handleColor: `[Color](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)`, backgroundColor: `[Color](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color)`)` | Cmn |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/selection/TextSelectionColors#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` | Cmn |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/selection/TextSelectionColors#hashCode())`()`                                                                                            | Cmn |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/selection/TextSelectionColors#toString())`()`                                                                                            | Cmn |

|                                   ### Public properties                                    |
|--------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Color](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color) | [backgroundColor](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/selection/TextSelectionColors#backgroundColor()) the color used to draw the background behind the selected region.        | Cmn |
| [Color](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color) | [handleColor](https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/selection/TextSelectionColors#handleColor()) the color used for the selection handles on either side of the selection region. | Cmn |

## Public constructors

### TextSelectionColors

Cmn  
Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)  

```
TextSelectionColors(handleColor: Color, backgroundColor: Color)
```

## Public functions

### equals

Cmn  

```
open operator fun equals(other: Any?): Boolean
```  

### hashCode

Cmn  

```
open fun hashCode(): Int
```  

### toString

Cmn  

```
open fun toString(): String
```

## Public properties

### backgroundColor

Cmn  
Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)  

```
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

Cmn  
Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)  

```
val handleColor: Color
```

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