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

Highlighting problem when using the dark theme on Windows. #811

Open
marioja opened this issue Sep 20, 2023 · 35 comments · May be fixed by eclipse-platform/eclipse.platform.ui#1690
Open

Highlighting problem when using the dark theme on Windows. #811

marioja opened this issue Sep 20, 2023 · 35 comments · May be fixed by eclipse-platform/eclipse.platform.ui#1690
Labels
Windows Happens on Windows OS

Comments

@marioja
Copy link

marioja commented Sep 20, 2023

Describe the bug
Highlighting problem when clicking between the left tree view and the right page in the Eclipse preference pages when using the dark theme.

To Reproduce
When using the Eclipse preferences dialog with the dark theme, the current preference in the left tree selection pane is not visible as soon as an item is selected in the right hand side preferences pane (problem-1). If I click back on the left tree selection item for the current preference page, then the selection of the current setting in the right hand window is no longer visible(problem-2). I will attach a screen shot of both problems. This does not happen with the Eclipse Classic theme and you can use that theme to see how things should work.

Expected behavior
I expect the left tree to always highlight the node when working on the right hand pane. I expect the current item in the right hand pane to remain highlighted when I click back on the node in the left tree.

Screenshots
Problem-1: You cannot notice that the current item in the tree is 'Keys'
image
Problem-2: You cannot notice that the current key settings in the right is Add Attribute to XML (or it is barely noticeable)
image

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)

Windows 10

  1. JRE/JDK version
    JDK 17
    Version since
    Eclipse 2023-09 (noticed in Eclipse 2023-03)

Workaround (or) Additional context
This problem also happens between the Enterprise Explorer and the editor tabs in the Java EE Perspective.

@Phillipus
Copy link
Contributor

If this is theme related you might want to report or transfer the issue here - https://github.com/eclipse-platform/eclipse.platform.ui/issues

@marioja
Copy link
Author

marioja commented Sep 21, 2023

Hi @Phillipus I opened it here because another issue which was fixed by a commit that you pointed out to me was fixed by correcting some code in this repository. I suspect that this might be the same problem again but I am not the expert here by any stretch. What should I do, create one also in eclipse-platform, transfer it to eclipse-platform or leave it here? BTW I presume that by "transfer" you mean recreate in other repo and close in this one?

@Phillipus
Copy link
Contributor

@marioja It might be an issue with one of the dark theme CSS files here. I suspect that might be the case rather than being SWT. Let's see if anyone else knows.

@marioja
Copy link
Author

marioja commented Sep 21, 2023

@Christopher-Hermann if you have time could you have a look at this problem. I apologize if I am breaking etiquette by tagging you.

@marioja
Copy link
Author

marioja commented Sep 22, 2023

Should I create a similar issue in eclipse.platform.ui repo also? I know you guys are just volunteers like me and you work on this in your free time but since I am a newbie I want to make sure that I have done the correct thing so that the correct volunteer can work on it in their free time. If I knew how to test this I would love to try to debug this myself but I am not certain how to do this. If someone had 15 minutes to point me in the right direction I might be able to look at this myself.

@Phillipus
Copy link
Contributor

@marioja I experimented with the CSS theme files in eclipse\plugins\org.eclipse.ui.themes_1.2.2200.v20230220-0932\css. I added the folllowing to the e4-dark_win.css file:

Shell Tree {
    color: #CCC;
}

With this the unfocussed selected Preferences tree text is whiter than the other tree nodes. Perhaps a clue there?

@marioja
Copy link
Author

marioja commented Sep 29, 2023

@Phillipus I tried to test this myself by modifying the same in my .p2 folder: C:\Users\Public.p2\pool\plugins\org.eclipse.ui.themes_1.2.2200.v20230220-0932\css\e4-dark_win.css
I restarted eclipse and I did not see any change. Am I missing something?

@Christopher-Hermann
Copy link
Contributor

Unfortunately, I'm not able to reproduce the error. I'm running on MacOS where everything works like expected. When I install eclipse on my VM, the preferences looks like this:
image
Do you have any special settings? For example, your scrollbar is painted a dark color while my scrollbar is gray.

@marioja
Copy link
Author

marioja commented Oct 4, 2023

@Christopher-Hermann Good day, thank you for chiming in. This problem is on Windows 10 as indicated in the original post on this issue. Do you have access to Windows 10? Windows 11 may work differently, I have not tested. As I said before, if someone can help me I could help work/test/fix this problem.

@marioja
Copy link
Author

marioja commented Dec 6, 2023

Sorry guys, Eclipse 2023-12 is out and this is still not fixed. Can anyone look into this? I always use dark them and it makes it really hard for my eyes to relate trees to selections. If someone could help me troubleshoot this on windows I am willing to help. I have no knowledge of the code base and I cannot do anything on my own. Ping me at mfj (at) earthling.net and we can connect.

Christopher-Hermann added a commit to Christopher-Hermann/eclipse.platform.ui that referenced this issue Dec 7, 2023
…tform/eclipse.platform.swt#811

SWT tree is using the OS color for selected items. This color is not accessible on Windows. This change overwrites the default selection color of a tree item with the color defined for the corresponding theme.

Fixes eclipse-platform/eclipse.platform.swt#811
@Christopher-Hermann
Copy link
Contributor

As far as I understand the SWT tree control is drawing the selection via the OS. So the OS theme decides about the color of the selection.

For example when I change my windows to high contrast mode, we can see that the selection color in the theme matches the selection color in eclipse:
Bildschirmfoto 2023-12-07 um 10 40 21

Since I only have access to a virtual Windows Server machine with limited configuration possibilities, I cannot manipulate the OS theme. @marioja Maybe you can try to configure your highlight color on your local Windows machine and confirm that this color is used for the selection in eclipse. Here is a description how this can be done: https://learn.microsoft.com/en-us/answers/questions/1193134/how-to-change-the-highlight-color-of-a-selected-de
This would at least help to really understand the issue.

I uploaded a commit where I do overwrite the default selection color with custom defined colors in eclipse, see Christopher-Hermann/eclipse.platform.ui@731c5ac
This solution works, but I'm not sure if this is a good solution:

  1. The color of the OS theme is overwritten, I'm not sure if this ok for other themes like high contrast
  2. The color of the selected item is drawn with a custom method, I'm afraid that this is not a good idea

Maybe someone can comment about my concerns. Currently I don't see a better solution for this issue.

@marioja
Copy link
Author

marioja commented Dec 7, 2023

I will do the test and report back. It would be nice if eclipse could respect the os current color scheme. I am running windows in dark mode and eclipse will use the white mode unless I switch to using the dark theme. On to testing...

@marioja
Copy link
Author

marioja commented Dec 8, 2023

ok, testing result. Unfortunately, with Windows 10 it is never simple. When you set windows to use dark mode so go to settings/colors and you select the Dark under choose your color. Unfortunately, this does not provide you with an option to select different colors for different components such as Selected text. This is only available when using the high contrast mode and when I select that, indeed Eclipse will use the Selected text color in the tree portion. But that is not an option since this problem is related to use case when one is not using high contrast mode. I will try to use your commit. @Christopher-Hermann How do I do this?

@marioja
Copy link
Author

marioja commented Dec 8, 2023

I personally think that your solution for respecting the eclipse dark theme colors in Windows by overriding how the selected text is written is perfectly acceptable. The current implementation of dark theme in Windows at least is totally based independent of the Windows dark mode settings and it should be. A developer should be able to use eclipse dark mode without having to switch to Windows dark mode or even if they switched.

One feature in the future could be that if you are running eclipse in a Windows using Light color then eclipse switches to Light theme and if you are using Windows in Dark color then eclipse switches to Dark theme. This again does not mean it would have to use the windows selected text color, it could still override it but just switches the theme based on the windows color.

There is still the possibility to have Eclipse use the windows theme colors to set the eclipse theme but that is something else and if we have control over eclipse themes and it works in either windows colors then there is no incentive IMHO.

@Christopher-Hermann
Copy link
Contributor

To use my commit you need to follow the description on https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#contributing-to-eclipse-platform

More accurate:

  1. Install an eclipse for eclipse development: https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md#creating-an-eclipse-development-environment
  2. Check out my commit via a git client: Christopher-Hermann/eclipse.platform.ui@731c5ac
  3. Make sure that following projects are imported: org.eclipse.jface, org.eclipse.ui
  4. Start the target IDE

@Christopher-Hermann
Copy link
Contributor

The problem with my commit is that the selection color is overwritten for all TreeViewers. I assume that this will also overwrite the color in viewers with custom coloring which is not acceptable. We could also change the coloring in the eclipse tree viewer for the preferences, but then we will end up with different colors in different trees which is also a really strange behavior.
I need to test how my change affects the custom coloring in other tree viewers.

@marioja
Copy link
Author

marioja commented Dec 21, 2023

I tried finally your branch, it took me long time to do step 1 and I think if I check out your commit in any eclipse and run an eclipse application it should work without all the rest of the 4G in the platform-sdk folder, but then again, this is all black magic so I am not sure if that is true.

When I navigate and the package explorer is active I am not sure I like that blue color. Should be selectable in preference maybe?

image

When I click on the editor tabs, the dark grey highlight in package explorer is quite good:

image

The same color apply in preferences, which is ok.

If the bright blue when the tree is active cannot be changed, it is still acceptable. Better if it could be user settable.

As for your comment about cusom coloring in other tree viewers maybe there could be a way for other tree viewers to no use these colors. What would those be using currently without your branch. If they behave as the rest of eclipse it is probably as bad. If they do not, well I guess they do not use the theme. Maybe an option is available to other tree viewers to use the theme or use the custom coloring. Or maybe using custom coloring could disable the behaviour you have introduced in your branch. I would love to have your branch in eclipse 2023-12 as soon as possible.

@marioja
Copy link
Author

marioja commented Dec 22, 2023

I just noticed the two preferences in Colors and Fonts (after looking at the branch and the code change). Cool. Personally, I prever Tree selection color focused to be RGB 81.155.255.
image

When can this code be added to an update for 2023-12?

@Christopher-Hermann
Copy link
Contributor

Christopher-Hermann commented Dec 29, 2023

I'm still testing the change with all kinds of Tree/Table viewers and custom coloring, cell coloring, etc. Up to now it looks quite promising. The only doubt that is left is that the blue color will be very strange for OS that have custom seleection colors, like Ubuntu with orange selection color.

Regarding your questions:

  • We could add the color to the color preferences, then they will be customizable. But of course we can also have a look if we can improve the default colors that are set.
  • The change will not be added to 2023-12. As soon as I finished the testing I can provide a pull request and if this requests gets approved, it will be shipped at earliest with 2024-03

P.S.: Thanks for testing the change and providing screenshots on Windows

@Christopher-Hermann
Copy link
Contributor

Christopher-Hermann commented Dec 29, 2023

I uploaded a new version of my commit with color support on tree viewer and table viewer. Furthermore you can change the colors in the preferences via Colors and Fonts > Basic > Selection ...

Here is a code snipped to test the different settings/styles. Could you import this project into your workspace and try it out under Windows? It would also be nice to have some screenshots. To open the test dialog you must: CTRL+3 and search for command "Open Viewer Demo Dialog"
viewerDemo.zip

I took the same colors as it is done in MacOS. So maybe they are not perfect on Windows, but at least the coding looks promising now. Here is a screenshot how it looks on MacOS:
JfaceViewers

My change was only possible for Table and Tree viewer, so most probably you will still have issues on the list viewer

@marioja
Copy link
Author

marioja commented Dec 29, 2023

I will look at your change. As for 2023-12, please note that I work for a large public sector organization. They are just in the process to move to 2023-12 which includes long awaited enterprise fixes in some IBM plugins. It would be extremely useful to have a back port of this fix in 2023-12 since upgrading follow long release cycles.
In the past I have had very low success doing this as the plugin repo is signed and it makes it difficult to introduce those changes myself. You help would be greatly appreciated.

@marioja
Copy link
Author

marioja commented Dec 29, 2023

Here is a screen shot of the Test viewer with selection on windows:
image
I tried clicking on the last row in each section. Unfortunately I was unable to get anything highlighted in the second columns

@marioja
Copy link
Author

marioja commented Dec 29, 2023

As for the Eclipse IDE, I could see the effect of the Colors and Fonts> Basic> Selection... in the preference dialogs.
However, I noticed that there is no highlighting for the Enterprise Explorer view and the source code tabs. This is very important as we spend more time in that use case than in the preference dialog box. I know that this use case might fall into the "list viewer" category (although the Enterprise Explorer looks like a tree viewer to me) but regardless of what category it falls, this feature is very important and is a must IMHO. This is the use case that made me create the issue in the first place. In that respect, the previous commit you had me test was better as it did handle this use case. Do you think you will be able to do something about it and do you think you will be able to do something about eclipse 2023-12?

@Christopher-Hermann
Copy link
Contributor

I'm not aware of the Enterprise Explorer view, how can I install this view?

@marioja
Copy link
Author

marioja commented Jan 22, 2024

Part of the java enterprise perspective which comes with Eclipse IDE for Enterprise Java and Web Developers

@Christopher-Hermann
Copy link
Contributor

Can you share a screenshot? I don't find a "Enterprise Explorer" view in the Eclipse IDE for Enterprise Java and Web Developers. I assume that this view is appiling a custom coloring in the Table/Tree. And as already discussed, it's highly incompatible to overwrite custom coloring.
In my first change, the coloring in the Table/Tree didn't pay attention to any custom coloring that is done from other plugins.

@marioja
Copy link
Author

marioja commented Jan 22, 2024

Will provide a screen shot later but it will show no highlighting. You need to open the java ee perspective. You can email me at mfj (at) earthling.net and we could chat and discuss if you want.

@marioja
Copy link
Author

marioja commented Jan 25, 2024

This is a screen shot using the Enterprise Explorer view. As you can see the Java source DCInitializer.java is not highlighted in the tree view on the left when my cursor is inside the java editor view on the right:
image
If I click on the Enterprise Explorer view title then you see the file highlighted in the tree view but this disappears as soon as I click in the java editor view.
image

@akurtakov
Copy link
Member

Just to be sure - does it happen when using "Project Explorer" ? We have to be 100% sure that it's not a problem in particular view.

Christopher-Hermann added a commit to Christopher-Hermann/eclipse.platform.ui that referenced this issue Feb 16, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
@BeckerWdf
Copy link
Contributor

BeckerWdf commented Feb 22, 2024

Just to be sure - does it happen when using "Project Explorer" ? We have to be 100% sure that it's not a problem in particular view.

@marioja: Can you answer this question?

@HeikoKlare
Copy link
Contributor

From my understanding, this is an issue of trees in general. This is how package/project explorer look like, when selecting the "src" folder and giving focus to the Java editor:
image

As you can see the Java source DCInitializer.java is not highlighted in the tree view on the left when my cursor is inside the java editor view on the right:

Note that it is not completely correct that the selected element is not hightlighted. It is only that the hightlight color is so similar to the background color that they are hard to distinguish. It may eben depend on your monitor whether you are able to identify any color difference.

@marioja
Copy link
Author

marioja commented Feb 26, 2024

Just to be sure - does it happen when using "Project Explorer" ? We have to be 100% sure that it's not a problem in particular view.

@marioja: Can you answer this question?

Sorry, I forgot. Will report back today

@marioja
Copy link
Author

marioja commented Feb 26, 2024

I don't know what the Project Explorer is. I switched to the Java perspective and the same problem occurs in the package explorer.

@marioja
Copy link
Author

marioja commented Feb 26, 2024

I found out the Project explorer view and tested. The highlighting issue occurs in all three explorers I could find. Enterprise explorer, project explorer and package explorer. @HeikoKlare thanks for your comments. I confirm your findings. I also had mentioned that the highlighting is barely perceptible in my original Sept 20 comment under the heading Problem 2 but thank you for pointing it out. @BeckerWdf @akurtakov is there anything else that you require to work on this? Also, could this be ported to Eclipse 2023-12 for the reasons I mentioned in my December 29 posts?

@akurtakov akurtakov added the Windows Happens on Windows OS label Feb 26, 2024
@chirontt
Copy link
Contributor

chirontt commented Apr 7, 2024

Thanks a lot to @Christopher-Hermann for your PR to fix this highlighting problem in Windows including the Windows on Arm64. I've built my own Eclipse SDK (for 2024-06) for Windows on Arm64 with your fix, and it works nicely.

@marioja have you gotten the fix to work with your Eclipse 2023-12 installation? I think you can rebuild the org.eclipse.jface and org.eclipse.ui plugins with the fix and substitute them in your own installation, without the need to rebuild/reinstall the complete Eclipse 2023-12 release.

chirontt pushed a commit to chirontt/eclipse.platform.ui that referenced this issue Apr 10, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
chirontt pushed a commit to chirontt/eclipse.platform.ui that referenced this issue Apr 14, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
chirontt pushed a commit to chirontt/eclipse.platform.ui that referenced this issue Apr 15, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
chirontt pushed a commit to chirontt/eclipse.platform.ui that referenced this issue Apr 17, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
Christopher-Hermann added a commit to Christopher-Hermann/eclipse.platform.ui that referenced this issue Apr 23, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
fedejeanne pushed a commit to Christopher-Hermann/eclipse.platform.ui that referenced this issue May 6, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
BeckerWdf pushed a commit to Christopher-Hermann/eclipse.platform.ui that referenced this issue May 13, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
Christopher-Hermann added a commit to Christopher-Hermann/eclipse.platform.ui that referenced this issue May 22, 2024
…tform/eclipse.platform.swt#811

JFace viewer are using OS selection color to highlight the selected item. On some OS this is not accessible. With this change, the selection color can be changed via color preference in the settings of eclipse.

Fixes eclipse-platform/eclipse.platform.swt#811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Happens on Windows OS
Projects
None yet
7 participants