Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Selection color not respecting brightness (Missing TextSelectionThemeData equivalent)🐛 #897

Closed
Michal-MK opened this issue Jul 23, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@Michal-MK
Copy link

Describe the bug
When selecting text in e.g. a TextBox, the selected text color does not match adjust based on accent brightness.

Setting "blue" theme color in Windows:
image

Results in:
image

While in Flutter:
image

The text stays black making it hard to read due to low contrast. In the FluentThemeData I found that there is no option to change text selection color, only the accentColor is used instead.

Expected behavior
Text on dark accent colors should be white.

environment:
  sdk: '>=3.0.1 <4.0.0'
 
dependencies:
  flutter:
    sdk: flutter

  fluent_ui: ^4.7.0
@bdlukaa
Copy link
Owner

bdlukaa commented Jul 23, 2023

This would only apply to the TextBox (and related) widget, since we don't really have control over the SelectableText widget for now.

Yet, there is still a blocker for this: flutter/flutter#99231
Even in material's TextSelectionThemeData, there isn't a property to change the text color to have a better contrast with the background.

I like the idea of having a text selection theme data, but I don't like the idea to implement it without the issue mentioned above being fixed first.

On the other hand, I'd suggest to use a lighter shade of the accentColor as the default selection color.

@bdlukaa bdlukaa added the enhancement New feature or request label Jul 23, 2023
@Michal-MK
Copy link
Author

I see. I am using the system accent color, so I cannot control that variable. I thought that the material selectable text style supported that (but I did not try). Let's see what flutter team comes up with then.

@bdlukaa
Copy link
Owner

bdlukaa commented Jul 27, 2023

It is also possible to use DefaultSelectionStyle in the FluentApp.builder method to wrap a custom selection style for the entire app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants