-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
eink text selection and SelectableLabel #4663
Comments
You mean this? egui/crates/egui/src/text_selection/visuals.rs Lines 19 to 20 in 814ad07
I think this affects the text selection, but not the And for the text selection, I guess it would be a matter of making the text even darker and the selection lighter to begin with? So they don't end up the same color after blending and rounding. |
What you need to understand with these screens is that there are really only 8 colors and that if you are outside of them, the code in the screen will "try" (by doing a sort of average with the colors of the surrounding pixels?) to give it a close value but it is not reliable. It is therefore absolutely necessary to be precise and choose only from these 8 colors. I was planning to submit an eink pull request, but in the meantime, here is my test:
|
Colors are:
As you can see binary a simple binary increment. |
That's not one of the allowed colors. Are you sure it doesn't work for the SelectableLabel? It seems to respect the colors you set. As for the text selection, the problem is that egui paints the selection after the text as mentioned in the code comment above, so the colors blend. The logic would have to be changed so the selection is painted first without changing the color of the text. There are other UIs that work like this, such as this GitHub page (and web pages in general), so maybe there is an argument to be made that egui should work like that as well, if it is possible. |
Yes, I have done further testing, this color "seems" good for my own testing but is not "safe" as a long term solution as it is a color generated by the firmware of the screen.
I think the problem is here: we can't choose the reverse color. |
There could be an option to override the text color when it is highlighted. Here on GitHub we have both possibilities: But before that can solve your problem, egui would have to paint the selection behind the text, instead of a transparent overlay on top of it, so the colors don't blend. Technically you could do that yourself, by making the default selection bg invisible and painting it manually using a |
So now there are plans to make the egui highlight work more like a web page highlight #4727. That should solve this e-paper problem as well. |
All is perfect since 0.29 and #4727 is closed. |
This is not really a bug nor really a feature. I'm not sure how to solve this question simply but it would be nice to find a solution.
The method of changing color in the context of selections or
SelectableLabel
does not seem generic.Example in
src/text_selection/visuals.rs
let color = visuals.selection.bg_fill.linear_multiply(0.5);
This doesn't work well if the screen supports a limited number and colors like e-ink screens.
This is an example where I try to create a basic style sheet. This screen supports 8 colors including obviously white and black.
Colors are:
As you can see from
SelectableLabel
, the selected one is unreadable. Same in case of text selection. Maybe there are other places?The text was updated successfully, but these errors were encountered: