material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.34k stars 3.06k forks source link

[TextInputEditText] The highlight color is different from the cursor color #2808

Closed almr0 closed 2 years ago

almr0 commented 2 years ago

I used all the styling attributes in the theme. (Except for additional attributes).

The theme is night and day. Theme.Material3.Light.NoActionBar and dark respectively

Why can't the selection color be changed? Even colorControlActivated and colorPrimary inside the TextInputEditText style does not save. The first attribute changes only the color of the cursor itself. There is zero information on this on the Internet at all. Screenshot_20220709-194418_VeartMe

almr0 commented 2 years ago

I found a solution in the dynamic Material 3 styles code. You need to use android:textColorHighlight attribute to change the color of the text selection. I ask developers to document this attribute in Material3 documentation, because it is very time consuming to find the answer. Especially in Material Components such problems were solved by using accent attribute.

OxygenCobalt commented 2 years ago

I remember reporting the same issue back in #2452. The maintainers said that they would discuss this, but there has been no updates since.

This is the offending text color in the library, which hard-codes a text color instead of using an attribute.

@drchen Any updates on if text highlighting will be changed to use color attributes?

leticiarossi commented 2 years ago

Hi, I will update the text field documentation to include information about android:textColorHighlight, (programmatically you can also call setHighlightColor on the edit text). We don't currently have plans on introducing a different attr for that

OxygenCobalt commented 2 years ago

Yeah, not surprised you aren't considering it, given that making the text color highlight color rely on attrs will not work <API 23.

tipa commented 1 year ago

That is disappointing to hear that the highlight color will not automatically adjust. This is contrary to how the rest of the theming system behaves.

GrigorevKirill commented 11 months ago

Any updates? We have the same issue