---
title: "TextFieldColors"
description: "Represents the colors of the input text, container, and content (including label, placeholder,
leading and trailing icons) used in a text field in different states."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
class TextFieldColors
constructor(
    val focusedTextColor: Color,
    val unfocusedTextColor: Color,
    val disabledTextColor: Color,
    val errorTextColor: Color,
    val focusedContainerColor: Color,
    val unfocusedContainerColor: Color,
    val disabledContainerColor: Color,
    val errorContainerColor: Color,
    val cursorColor: Color,
    val errorCursorColor: Color,
    val textSelectionColors: TextSelectionColors,
    val focusedIndicatorColor: Color,
    val unfocusedIndicatorColor: Color,
    val disabledIndicatorColor: Color,
    val errorIndicatorColor: Color,
    val focusedLeadingIconColor: Color,
    val unfocusedLeadingIconColor: Color,
    val disabledLeadingIconColor: Color,
    val errorLeadingIconColor: Color,
    val focusedTrailingIconColor: Color,
    val unfocusedTrailingIconColor: Color,
    val disabledTrailingIconColor: Color,
    val errorTrailingIconColor: Color,
    val focusedLabelColor: Color,
    val unfocusedLabelColor: Color,
    val disabledLabelColor: Color,
    val errorLabelColor: Color,
    val focusedPlaceholderColor: Color,
    val unfocusedPlaceholderColor: Color,
    val disabledPlaceholderColor: Color,
    val errorPlaceholderColor: Color,
    val focusedSupportingTextColor: Color,
    val unfocusedSupportingTextColor: Color,
    val disabledSupportingTextColor: Color,
    val errorSupportingTextColor: Color,
    val focusedPrefixColor: Color,
    val unfocusedPrefixColor: Color,
    val disabledPrefixColor: Color,
    val errorPrefixColor: Color,
    val focusedSuffixColor: Color,
    val unfocusedSuffixColor: Color,
    val disabledSuffixColor: Color,
    val errorSuffixColor: Color,
)
```


Represents the colors of the input text, container, and content (including label, placeholder,
leading and trailing icons) used in a text field in different states.

#### Parameters

| | |
| --- | --- |
| focusedTextColor | the color used for the input text of this text field when focused |
| unfocusedTextColor | the color used for the input text of this text field when not focused |
| disabledTextColor | the color used for the input text of this text field when disabled |
| errorTextColor | the color used for the input text of this text field when in error state |
| focusedContainerColor | the container color for this text field when focused |
| unfocusedContainerColor | the container color for this text field when not focused |
| disabledContainerColor | the container color for this text field when disabled |
| errorContainerColor | the container color for this text field when in error state |
| cursorColor | the cursor color for this text field |
| errorCursorColor | the cursor color for this text field when in error state |
| textSelectionColors | the colors used when the input text of this text field is selected |
| focusedIndicatorColor | the indicator color for this text field when focused |
| unfocusedIndicatorColor | the indicator color for this text field when not focused |
| disabledIndicatorColor | the indicator color for this text field when disabled |
| errorIndicatorColor | the indicator color for this text field when in error state |
| focusedLeadingIconColor | the leading icon color for this text field when focused |
| unfocusedLeadingIconColor | the leading icon color for this text field when not focused |
| disabledLeadingIconColor | the leading icon color for this text field when disabled |
| errorLeadingIconColor | the leading icon color for this text field when in error state |
| focusedTrailingIconColor | the trailing icon color for this text field when focused |
| unfocusedTrailingIconColor | the trailing icon color for this text field when not focused |
| disabledTrailingIconColor | the trailing icon color for this text field when disabled |
| errorTrailingIconColor | the trailing icon color for this text field when in error state |
| focusedLabelColor | the label color for this text field when focused |
| unfocusedLabelColor | the label color for this text field when not focused |
| disabledLabelColor | the label color for this text field when disabled |
| errorLabelColor | the label color for this text field when in error state |
| focusedPlaceholderColor | the placeholder color for this text field when focused |
| unfocusedPlaceholderColor | the placeholder color for this text field when not focused |
| disabledPlaceholderColor | the placeholder color for this text field when disabled |
| errorPlaceholderColor | the placeholder color for this text field when in error state |
| focusedSupportingTextColor | the supporting text color for this text field when focused |
| unfocusedSupportingTextColor | the supporting text color for this text field when not focused |
| disabledSupportingTextColor | the supporting text color for this text field when disabled |
| errorSupportingTextColor | the supporting text color for this text field when in error state |
| focusedPrefixColor | the prefix color for this text field when focused |
| unfocusedPrefixColor | the prefix color for this text field when not focused |
| disabledPrefixColor | the prefix color for this text field when disabled |
| errorPrefixColor | the prefix color for this text field when in error state |
| focusedSuffixColor | the suffix color for this text field when focused |
| unfocusedSuffixColor | the suffix color for this text field when not focused |
| disabledSuffixColor | the suffix color for this text field when disabled |
| errorSuffixColor | the suffix color for this text field when in error state |



## Functions

```kotlin
fun copy(
        focusedTextColor: Color = this.focusedTextColor,
        unfocusedTextColor: Color = this.unfocusedTextColor,
        disabledTextColor: Color = this.disabledTextColor,
        errorTextColor: Color = this.errorTextColor,
        focusedContainerColor: Color = this.focusedContainerColor,
        unfocusedContainerColor: Color = this.unfocusedContainerColor,
        disabledContainerColor: Color = this.disabledContainerColor,
        errorContainerColor: Color = this.errorContainerColor,
        cursorColor: Color = this.cursorColor,
        errorCursorColor: Color = this.errorCursorColor,
        textSelectionColors: TextSelectionColors? = this.textSelectionColors,
        focusedIndicatorColor: Color = this.focusedIndicatorColor,
        unfocusedIndicatorColor: Color = this.unfocusedIndicatorColor,
        disabledIndicatorColor: Color = this.disabledIndicatorColor,
        errorIndicatorColor: Color = this.errorIndicatorColor,
        focusedLeadingIconColor: Color = this.focusedLeadingIconColor,
        unfocusedLeadingIconColor: Color = this.unfocusedLeadingIconColor,
        disabledLeadingIconColor: Color = this.disabledLeadingIconColor,
        errorLeadingIconColor: Color = this.errorLeadingIconColor,
        focusedTrailingIconColor: Color = this.focusedTrailingIconColor,
        unfocusedTrailingIconColor: Color = this.unfocusedTrailingIconColor,
        disabledTrailingIconColor: Color = this.disabledTrailingIconColor,
        errorTrailingIconColor: Color = this.errorTrailingIconColor,
        focusedLabelColor: Color = this.focusedLabelColor,
        unfocusedLabelColor: Color = this.unfocusedLabelColor,
        disabledLabelColor: Color = this.disabledLabelColor,
        errorLabelColor: Color = this.errorLabelColor,
        focusedPlaceholderColor: Color = this.focusedPlaceholderColor,
        unfocusedPlaceholderColor: Color = this.unfocusedPlaceholderColor,
        disabledPlaceholderColor: Color = this.disabledPlaceholderColor,
        errorPlaceholderColor: Color = this.errorPlaceholderColor,
        focusedSupportingTextColor: Color = this.focusedSupportingTextColor,
        unfocusedSupportingTextColor: Color = this.unfocusedSupportingTextColor,
        disabledSupportingTextColor: Color = this.disabledSupportingTextColor,
        errorSupportingTextColor: Color = this.errorSupportingTextColor,
        focusedPrefixColor: Color = this.focusedPrefixColor,
        unfocusedPrefixColor: Color = this.unfocusedPrefixColor,
        disabledPrefixColor: Color = this.disabledPrefixColor,
        errorPrefixColor: Color = this.errorPrefixColor,
        focusedSuffixColor: Color = this.focusedSuffixColor,
        unfocusedSuffixColor: Color = this.unfocusedSuffixColor,
        disabledSuffixColor: Color = this.disabledSuffixColor,
        errorSuffixColor: Color = this.errorSuffixColor,
    ) =
        TextFieldColors(
            focusedTextColor.takeOrElse { this.focusedTextColor },
            unfocusedTextColor.takeOrElse { this.unfocusedTextColor },
            disabledTextColor.takeOrElse { this.disabledTextColor },
            errorTextColor.takeOrElse { this.errorTextColor },
            focusedContainerColor.takeOrElse { this.focusedContainerColor },
            unfocusedContainerColor.takeOrElse { this.unfocusedContainerColor },
            disabledContainerColor.takeOrElse { this.disabledContainerColor },
            errorContainerColor.takeOrElse { this.errorContainerColor },
            cursorColor.takeOrElse { this.cursorColor },
            errorCursorColor.takeOrElse { this.errorCursorColor },
            textSelectionColors.takeOrElse { this.textSelectionColors },
            focusedIndicatorColor.takeOrElse { this.focusedIndicatorColor },
            unfocusedIndicatorColor.takeOrElse { this.unfocusedIndicatorColor },
            disabledIndicatorColor.takeOrElse { this.disabledIndicatorColor },
            errorIndicatorColor.takeOrElse { this.errorIndicatorColor },
            focusedLeadingIconColor.takeOrElse { this.focusedLeadingIconColor },
            unfocusedLeadingIconColor.takeOrElse { this.unfocusedLeadingIconColor },
            disabledLeadingIconColor.takeOrElse { this.disabledLeadingIconColor },
            errorLeadingIconColor.takeOrElse { this.errorLeadingIconColor },
            focusedTrailingIconColor.takeOrElse { this.focusedTrailingIconColor },
            unfocusedTrailingIconColor.takeOrElse { this.unfocusedTrailingIconColor },
            disabledTrailingIconColor.takeOrElse { this.disabledTrailingIconColor },
            errorTrailingIconColor.takeOrElse { this.errorTrailingIconColor },
            focusedLabelColor.takeOrElse { this.focusedLabelColor },
            unfocusedLabelColor.takeOrElse { this.unfocusedLabelColor },
            disabledLabelColor.takeOrElse { this.disabledLabelColor },
            errorLabelColor.takeOrElse { this.errorLabelColor },
            focusedPlaceholderColor.takeOrElse { this.focusedPlaceholderColor },
            unfocusedPlaceholderColor.takeOrElse { this.unfocusedPlaceholderColor },
            disabledPlaceholderColor.takeOrElse { this.disabledPlaceholderColor },
            errorPlaceholderColor.takeOrElse { this.errorPlaceholderColor },
            focusedSupportingTextColor.takeOrElse { this.focusedSupportingTextColor },
            unfocusedSupportingTextColor.takeOrElse { this.unfocusedSupportingTextColor },
            disabledSupportingTextColor.takeOrElse { this.disabledSupportingTextColor },
            errorSupportingTextColor.takeOrElse { this.errorSupportingTextColor },
            focusedPrefixColor.takeOrElse { this.focusedPrefixColor },
            unfocusedPrefixColor.takeOrElse { this.unfocusedPrefixColor },
            disabledPrefixColor.takeOrElse { this.disabledPrefixColor },
            errorPrefixColor.takeOrElse { this.errorPrefixColor },
            focusedSuffixColor.takeOrElse { this.focusedSuffixColor },
            unfocusedSuffixColor.takeOrElse { this.unfocusedSuffixColor },
            disabledSuffixColor.takeOrElse { this.disabledSuffixColor },
            errorSuffixColor.takeOrElse { this.errorSuffixColor },
        )
```


Returns a copy of this ChipColors, optionally overriding some of the values. This uses the
Color.Unspecified to mean “use the value from the source”


```kotlin
fun leadingIconColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the color used for the leading icon of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun trailingIconColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the color used for the trailing icon of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun indicatorColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the color used for the border indicator of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun containerColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the container color for this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun placeholderColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the color used for the placeholder of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun labelColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the color used for the label of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun textColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the color used for the input field of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun supportingTextColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the colors used for the supporting text of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun prefixColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the color used for the prefix of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun suffixColor(enabled: Boolean, isError: Boolean, focused: Boolean): Color
```


Represents the color used for the suffix of this text field.

#### Parameters

| | |
| --- | --- |
| enabled | whether the text field is enabled |
| isError | whether the text field's current value is in error |
| focused | whether the text field is in focus |



```kotlin
fun cursorColor(isError: Boolean): Color
```


Represents the color used for the cursor of this text field.

#### Parameters

| | |
| --- | --- |
| isError | whether the text field's current value is in error |




