{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

TextFieldColors

public final class TextFieldColors


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.

Summary

Public constructors

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

create an instance with arbitrary colors.

Public methods

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

Returns a copy of this ChipColors, optionally overriding some of the values.

boolean
equals(Object other)
final @NonNull Color

the cursor color for this text field

final @NonNull Color

the container color for this text field when disabled

final @NonNull Color

the indicator color for this text field when disabled

final @NonNull Color

the label color for this text field when disabled

final @NonNull Color

the leading icon color for this text field when disabled

final @NonNull Color

the placeholder color for this text field when disabled

final @NonNull Color

the prefix color for this text field when disabled

final @NonNull Color

the suffix color for this text field when disabled

final @NonNull Color

the supporting text color for this text field when disabled

final @NonNull Color

the color used for the input text of this text field when disabled

final @NonNull Color

the trailing icon color for this text field when disabled

final @NonNull Color

the container color for this text field when in error state

final @NonNull Color

the cursor color for this text field when in error state

final @NonNull Color

the indicator color for this text field when in error state

final @NonNull Color

the label color for this text field when in error state

final @NonNull Color

the leading icon color for this text field when in error state

final @NonNull Color

the placeholder color for this text field when in error state

final @NonNull Color

the prefix color for this text field when in error state

final @NonNull Color

the suffix color for this text field when in error state

final @NonNull Color

the supporting text color for this text field when in error state

final @NonNull Color

the color used for the input text of this text field when in error state

final @NonNull Color

the trailing icon color for this text field when in error state

final @NonNull Color

the container color for this text field when focused

final @NonNull Color

the indicator color for this text field when focused

final @NonNull Color

the label color for this text field when focused

final @NonNull Color

the leading icon color for this text field when focused

final @NonNull Color

the placeholder color for this text field when focused

final @NonNull Color

the prefix color for this text field when focused

final @NonNull Color

the suffix color for this text field when focused

final @NonNull Color

the supporting text color for this text field when focused

final @NonNull Color

the color used for the input text of this text field when focused

final @NonNull Color

the trailing icon color for this text field when focused

final @NonNull TextSelectionColors

the colors used when the input text of this text field is selected

final @NonNull Color

the container color for this text field when not focused

final @NonNull Color

the indicator color for this text field when not focused

final @NonNull Color

the label color for this text field when not focused

final @NonNull Color

the leading icon color for this text field when not focused

final @NonNull Color

the placeholder color for this text field when not focused

final @NonNull Color

the prefix color for this text field when not focused

final @NonNull Color

the suffix color for this text field when not focused

final @NonNull Color

the supporting text color for this text field when not focused

final @NonNull Color

the color used for the input text of this text field when not focused

final @NonNull Color

the trailing icon color for this text field when not focused

int

Public constructors

TextFieldColors

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

create an instance with arbitrary colors. See TextFieldDefaults.colors for the default colors used in TextField. See OutlinedTextFieldDefaults.colors for the default colors used in OutlinedTextField.

Parameters
@NonNull Color focusedTextColor

the color used for the input text of this text field when focused

@NonNull Color unfocusedTextColor

the color used for the input text of this text field when not focused

@NonNull Color disabledTextColor

the color used for the input text of this text field when disabled

@NonNull Color errorTextColor

the color used for the input text of this text field when in error state

@NonNull Color focusedContainerColor

the container color for this text field when focused

@NonNull Color unfocusedContainerColor

the container color for this text field when not focused

@NonNull Color disabledContainerColor

the container color for this text field when disabled

@NonNull Color errorContainerColor

the container color for this text field when in error state

@NonNull Color cursorColor

the cursor color for this text field

@NonNull Color errorCursorColor

the cursor color for this text field when in error state

@NonNull TextSelectionColors textSelectionColors

the colors used when the input text of this text field is selected

@NonNull Color focusedIndicatorColor

the indicator color for this text field when focused

@NonNull Color unfocusedIndicatorColor

the indicator color for this text field when not focused

@NonNull Color disabledIndicatorColor

the indicator color for this text field when disabled

@NonNull Color errorIndicatorColor

the indicator color for this text field when in error state

@NonNull Color focusedLeadingIconColor

the leading icon color for this text field when focused

@NonNull Color unfocusedLeadingIconColor

the leading icon color for this text field when not focused

@NonNull Color disabledLeadingIconColor

the leading icon color for this text field when disabled

@NonNull Color errorLeadingIconColor

the leading icon color for this text field when in error state

@NonNull Color focusedTrailingIconColor

the trailing icon color for this text field when focused

@NonNull Color unfocusedTrailingIconColor

the trailing icon color for this text field when not focused

@NonNull Color disabledTrailingIconColor

the trailing icon color for this text field when disabled

@NonNull Color errorTrailingIconColor

the trailing icon color for this text field when in error state

@NonNull Color focusedLabelColor

the label color for this text field when focused

@NonNull Color unfocusedLabelColor

the label color for this text field when not focused

@NonNull Color disabledLabelColor

the label color for this text field when disabled

@NonNull Color errorLabelColor

the label color for this text field when in error state

@NonNull Color focusedPlaceholderColor

the placeholder color for this text field when focused

@NonNull Color unfocusedPlaceholderColor

the placeholder color for this text field when not focused

@NonNull Color disabledPlaceholderColor

the placeholder color for this text field when disabled

@NonNull Color errorPlaceholderColor

the placeholder color for this text field when in error state

@NonNull Color focusedSupportingTextColor

the supporting text color for this text field when focused

@NonNull Color unfocusedSupportingTextColor

the supporting text color for this text field when not focused

@NonNull Color disabledSupportingTextColor

the supporting text color for this text field when disabled

@NonNull Color errorSupportingTextColor

the supporting text color for this text field when in error state

@NonNull Color focusedPrefixColor

the prefix color for this text field when focused

@NonNull Color unfocusedPrefixColor

the prefix color for this text field when not focused

@NonNull Color disabledPrefixColor

the prefix color for this text field when disabled

@NonNull Color errorPrefixColor

the prefix color for this text field when in error state

@NonNull Color focusedSuffixColor

the suffix color for this text field when focused

@NonNull Color unfocusedSuffixColor

the suffix color for this text field when not focused

@NonNull Color disabledSuffixColor

the suffix color for this text field when disabled

@NonNull Color errorSuffixColor

the suffix color for this text field when in error state

Public methods

copy

public final @NonNull TextFieldColors copy(
    @NonNull Color focusedTextColor,
    @NonNull Color unfocusedTextColor,
    @NonNull Color disabledTextColor,
    @NonNull Color errorTextColor,
    @NonNull Color focusedContainerColor,
    @NonNull Color unfocusedContainerColor,
    @NonNull Color disabledContainerColor,
    @NonNull Color errorContainerColor,
    @NonNull Color cursorColor,
    @NonNull Color errorCursorColor,
    TextSelectionColors textSelectionColors,
    @NonNull Color focusedIndicatorColor,
    @NonNull Color unfocusedIndicatorColor,
    @NonNull Color disabledIndicatorColor,
    @NonNull Color errorIndicatorColor,
    @NonNull Color focusedLeadingIconColor,
    @NonNull Color unfocusedLeadingIconColor,
    @NonNull Color disabledLeadingIconColor,
    @NonNull Color errorLeadingIconColor,
    @NonNull Color focusedTrailingIconColor,
    @NonNull Color unfocusedTrailingIconColor,
    @NonNull Color disabledTrailingIconColor,
    @NonNull Color errorTrailingIconColor,
    @NonNull Color focusedLabelColor,
    @NonNull Color unfocusedLabelColor,
    @NonNull Color disabledLabelColor,
    @NonNull Color errorLabelColor,
    @NonNull Color focusedPlaceholderColor,
    @NonNull Color unfocusedPlaceholderColor,
    @NonNull Color disabledPlaceholderColor,
    @NonNull Color errorPlaceholderColor,
    @NonNull Color focusedSupportingTextColor,
    @NonNull Color unfocusedSupportingTextColor,
    @NonNull Color disabledSupportingTextColor,
    @NonNull Color errorSupportingTextColor,
    @NonNull Color focusedPrefixColor,
    @NonNull Color unfocusedPrefixColor,
    @NonNull Color disabledPrefixColor,
    @NonNull Color errorPrefixColor,
    @NonNull Color focusedSuffixColor,
    @NonNull Color unfocusedSuffixColor,
    @NonNull Color disabledSuffixColor,
    @NonNull Color 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”

equals

public boolean equals(Object other)

getCursorColor

public final @NonNull Color getCursorColor()

the cursor color for this text field

getDisabledContainerColor

public final @NonNull Color getDisabledContainerColor()

the container color for this text field when disabled

getDisabledIndicatorColor

public final @NonNull Color getDisabledIndicatorColor()

the indicator color for this text field when disabled

getDisabledLabelColor

public final @NonNull Color getDisabledLabelColor()

the label color for this text field when disabled

getDisabledLeadingIconColor

public final @NonNull Color getDisabledLeadingIconColor()

the leading icon color for this text field when disabled

getDisabledPlaceholderColor

public final @NonNull Color getDisabledPlaceholderColor()

the placeholder color for this text field when disabled

getDisabledPrefixColor

public final @NonNull Color getDisabledPrefixColor()

the prefix color for this text field when disabled

getDisabledSuffixColor

public final @NonNull Color getDisabledSuffixColor()

the suffix color for this text field when disabled

getDisabledSupportingTextColor

public final @NonNull Color getDisabledSupportingTextColor()

the supporting text color for this text field when disabled

getDisabledTextColor

public final @NonNull Color getDisabledTextColor()

the color used for the input text of this text field when disabled

getDisabledTrailingIconColor

public final @NonNull Color getDisabledTrailingIconColor()

the trailing icon color for this text field when disabled

getErrorContainerColor

public final @NonNull Color getErrorContainerColor()

the container color for this text field when in error state

getErrorCursorColor

public final @NonNull Color getErrorCursorColor()

the cursor color for this text field when in error state

getErrorIndicatorColor

public final @NonNull Color getErrorIndicatorColor()

the indicator color for this text field when in error state

getErrorLabelColor

public final @NonNull Color getErrorLabelColor()

the label color for this text field when in error state

getErrorLeadingIconColor

public final @NonNull Color getErrorLeadingIconColor()

the leading icon color for this text field when in error state

getErrorPlaceholderColor

public final @NonNull Color getErrorPlaceholderColor()

the placeholder color for this text field when in error state

getErrorPrefixColor

public final @NonNull Color getErrorPrefixColor()

the prefix color for this text field when in error state

getErrorSuffixColor

public final @NonNull Color getErrorSuffixColor()

the suffix color for this text field when in error state

getErrorSupportingTextColor

public final @NonNull Color getErrorSupportingTextColor()

the supporting text color for this text field when in error state

getErrorTextColor

public final @NonNull Color getErrorTextColor()

the color used for the input text of this text field when in error state

getErrorTrailingIconColor

public final @NonNull Color getErrorTrailingIconColor()

the trailing icon color for this text field when in error state

getFocusedContainerColor

public final @NonNull Color getFocusedContainerColor()

the container color for this text field when focused

getFocusedIndicatorColor

public final @NonNull Color getFocusedIndicatorColor()

the indicator color for this text field when focused

getFocusedLabelColor

public final @NonNull Color getFocusedLabelColor()

the label color for this text field when focused

getFocusedLeadingIconColor

public final @NonNull Color getFocusedLeadingIconColor()

the leading icon color for this text field when focused

getFocusedPlaceholderColor

public final @NonNull Color getFocusedPlaceholderColor()

the placeholder color for this text field when focused

getFocusedPrefixColor

public final @NonNull Color getFocusedPrefixColor()

the prefix color for this text field when focused

getFocusedSuffixColor

public final @NonNull Color getFocusedSuffixColor()

the suffix color for this text field when focused

getFocusedSupportingTextColor

public final @NonNull Color getFocusedSupportingTextColor()

the supporting text color for this text field when focused

getFocusedTextColor

public final @NonNull Color getFocusedTextColor()

the color used for the input text of this text field when focused

getFocusedTrailingIconColor

public final @NonNull Color getFocusedTrailingIconColor()

the trailing icon color for this text field when focused

getTextSelectionColors

public final @NonNull TextSelectionColors getTextSelectionColors()

the colors used when the input text of this text field is selected

getUnfocusedContainerColor

public final @NonNull Color getUnfocusedContainerColor()

the container color for this text field when not focused

getUnfocusedIndicatorColor

public final @NonNull Color getUnfocusedIndicatorColor()

the indicator color for this text field when not focused

getUnfocusedLabelColor

public final @NonNull Color getUnfocusedLabelColor()

the label color for this text field when not focused

getUnfocusedLeadingIconColor

public final @NonNull Color getUnfocusedLeadingIconColor()

the leading icon color for this text field when not focused

getUnfocusedPlaceholderColor

public final @NonNull Color getUnfocusedPlaceholderColor()

the placeholder color for this text field when not focused

getUnfocusedPrefixColor

public final @NonNull Color getUnfocusedPrefixColor()

the prefix color for this text field when not focused

getUnfocusedSuffixColor

public final @NonNull Color getUnfocusedSuffixColor()

the suffix color for this text field when not focused

getUnfocusedSupportingTextColor

public final @NonNull Color getUnfocusedSupportingTextColor()

the supporting text color for this text field when not focused

getUnfocusedTextColor

public final @NonNull Color getUnfocusedTextColor()

the color used for the input text of this text field when not focused

getUnfocusedTrailingIconColor

public final @NonNull Color getUnfocusedTrailingIconColor()

the trailing icon color for this text field when not focused

hashCode

public int hashCode()