-
Notifications
You must be signed in to change notification settings - Fork 137
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.setMessage: message text not or barely visible on all color combinations #822
Comments
Add cache invalidation only to obvious places for now.
Breadth first traversal is somewhat similar lazy TreeViewer from JFace does on reveal - it populates a whole level of a tree, then select an item and goes down a level.
The problem also exists on Linux, just with a slightly different color. Here a screenshot from a modified version of the snippet provided for this issue: The issue seems to be that the color for the text box hint (cue) is fixed by the OS. At least for windows, I did not find a way to modify this color. Here is the documentation for setting the cue text: https://learn.microsoft.com/en-US/windows/win32/controls/em-setcuebanner So at least on Windows it seems to be necessary to make the hint custom-drawn to better support theming. Most of the functionality is already implemented in the eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java Lines 177 to 179 in 77f7396
When removing the check for read-only, the message will always be custom-drawn unless a text is set. The color applied for that custom-draw text is currently fixed: eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java Line 231 in 77f7396
But it could be calculated depending on the background color, e.g.: int backgroundGrayValue = (getBackground().getRed() + getBackground().getBlue() + getBackground().getGreen()) / 3;
int hintGrayValue = backgroundGrayValue + (backgroundGrayValue > 128 ? -128 : 128);
Color hintColor= new Color(hintGrayValue, hintGrayValue, hintGrayValue);
OS.SetTextColor (hDC, hintColor.handle); The example provided for the issue will then look as follows: In comparison to the original: For Linux and Mac, this custom logic for drawing the message does not exist. So in case there is no native way for setting the hint text color for those operating systems, some more functionality would need to be added in comparison to the Windows implementation. However, I am not sure whether it's worth the effort to develop and maintain the custom logic, since the color only seems to be a problem with custom background colors. With standard dark theme, it looks as follows on my system: |
Describe the bug
Depending on the color-combination, a message set using Text.setMessage is not visible.
To Reproduce
Snippet
Expected behavior
I either expect the message-Color to be automatically updated in such a way that it has good contrast values or I want to be able to set the message-color.
Screenshots
Environment:
Windows 11
Version since
I'm running SWT from the master branch
Workaround (or) Additional context
I took this issue from platform.ui
Where I need this to implement my proposal filed here
The text was updated successfully, but these errors were encountered: