Bug 564960 - Selected file not visible in Inactive Project Explorer in Dark Theme
Summary: Selected file not visible in Inactive Project Explorer in Dark Theme
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 10
: P3 major with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 568072 (view as bug list)
Depends on: 562043
Blocks:
  Show dependency tree
 
Reported: 2020-07-06 05:31 EDT by Zaheer Ahmad CLA
Modified: 2023-08-12 10:30 EDT (History)
11 users (show)

See Also:
daniel_megert: pmc_approved+


Attachments
Problem Image (267.49 KB, image/png)
2021-05-21 16:27 EDT, Zaheer Ahmad CLA
no flags Details
Dark with patch (114.78 KB, image/png)
2021-08-11 02:40 EDT, Lars Vogel CLA
no flags Details
example from egit plugin (36.36 KB, image/png)
2021-08-11 09:27 EDT, Zaheer Ahmad CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zaheer Ahmad CLA 2020-07-06 05:31:43 EDT
Eclipse uses Windows based scheme to display Project explorer elements, in dark theme a selected file Background color is not visible when respective tab is not active. As we can colors for git (not commited files) please also add functionality to change colors other than windows scheme.
Comment 1 Rolf Theunissen CLA 2020-07-06 06:24:37 EDT
Possible duplicate or at least related to Bug 562043
Comment 2 Reinhard Handler CLA 2020-07-07 05:28:17 EDT
Similar to https://bugs.eclipse.org/bugs/show_bug.cgi?id=564822
Comment 3 Zaheer Ahmad CLA 2020-08-21 05:10:09 EDT
Hi, i dont see any fix in related bugs for the problem i mentioned. Here is also a link of my question in a fourm with pictures

https://stackoverflow.com/questions/62876202/eclipse-2020-06-v4-16-dark-theme-problems-solution-in-css
Comment 4 Rolf Theunissen CLA 2020-08-21 05:40:26 EDT
Bug 562043 should have fixed the root cause that selection was not visible at all.

However, the selection is still hardly visible, its a slightly darker background on a already dark background.

What work is left here to do?
Comment 5 Zaheer Ahmad CLA 2020-08-21 05:48:47 EDT
Yes thats what the problem is if you are working on Java Editor Tab and want to see selected file, its very hardly visible. Window Dark Selection Highlighted Background Color is dark and on already Dark Background of Project Explorer.

So either with should have a box as in 2020-05 version or we should have a customization as we have for git colors in Preferences. They also work and same way just highlighted file color Active or Inactive Tab can work. 

Its just a suggestion as i see colors for Tree Structures are still same in next release so i dont think its fixed. 
https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/167993. I dont see a picture of Project Explorer Tab Inactive.
Comment 6 Rolf Theunissen CLA 2020-08-22 06:39:30 EDT
The root cause that the selection color is still hardly visible now, is that the color is very close to the (custom) background color used in the Windows Dark theme.

However the selection colors can no longer be customized, See Bug 562865. The original Bug 434309 has been reopened.

Making the background darker does show the selected items
Comment 7 Eclipse Genie CLA 2020-08-22 11:19:27 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/168094
Comment 8 Rolf Theunissen CLA 2020-08-22 11:24:30 EDT
(In reply to Eclipse Genie from comment #7)
> New Gerrit change created:
> https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/168094

This doesn't make consistency better between Trees and Tables, but that is difficult as the selection color is different in these, see Bug 566280.
However, it does increase visibility of the inactive selection in Trees.

Furthermore, the background as defined in EGit for changed files is hardcoded too.  So there are still some glitches in the colors.
Comment 9 Zaheer Ahmad CLA 2020-08-25 12:07:14 EDT
I just want that in black Theme in future version color of Selected file is visible (Active or Inactive Tab) should be visible as its clearly visible in Normal Theme. Blackich on Black Background is not visible. I think linked issues are not exactly mentioning this issue.
Comment 10 Rolf Theunissen CLA 2020-08-31 04:37:50 EDT
Will not push this for 4.17, due to issues left (inconsistency with EGit) and no agreement on the change.
Comment 11 Rolf Theunissen CLA 2020-11-01 06:38:46 EST
*** Bug 568072 has been marked as a duplicate of this bug. ***
Comment 12 Reinhard Handler CLA 2021-01-08 04:05:54 EST
So bug 566280 has to be fixed first before we can get a fix here? Is bug 434309 still somehow dependent?
Comment 13 Zaheer Ahmad CLA 2021-03-02 06:11:48 EST
Sadly 2 version are released and this Bug still exist in dark theme, and its impair the use of Project Explorer.
Comment 14 Zaheer Ahmad CLA 2021-05-21 16:27:02 EDT
Created attachment 286437 [details]
Problem Image

Problem Image
Comment 15 Lars Vogel CLA 2021-08-11 02:40:37 EDT
Created attachment 286917 [details]
Dark with patch

With the attached Gerrit, the dark theme looks broken.
Comment 16 Rolf Theunissen CLA 2021-08-11 04:08:47 EDT
(In reply to Lars Vogel from comment #15)
> Created attachment 286917 [details]
> Dark with patch
> 
> With the attached Gerrit, the dark theme looks broken.

Can you explain what 'broken' means? I see that that tree views have similar looks as the native Dark theme of Windows (i.e. File Explorer). This might not be the preferred way to fix this, but as long as nobody can fix the selection color, changing the background is the only alternative.

For me this invisible selection is a blocker to use the dark theme.
Comment 17 Lars Vogel CLA 2021-08-11 04:22:52 EDT
(In reply to Rolf Theunissen from comment #16)
> (In reply to Lars Vogel from comment #15)
> > Created attachment 286917 [details]
> > Dark with patch
> > 
> > With the attached Gerrit, the dark theme looks broken.
> 
> Can you explain what 'broken' means? I see that that tree views have similar
> looks as the native Dark theme of Windows (i.e. File Explorer). This might
> not be the preferred way to fix this, but as long as nobody can fix the
> selection color, changing the background is the only alternative.

Current dark theme uses a similar color for the editor and the views, with the change the theme uses different colors which looks bad to me.

> For me this invisible selection is a blocker to use the dark theme.

We could change the hard-coded color to a colors which could be changed via the Colors and Fonts preferences. This way users which find the current selection contrast unacceptable at least change the preference. If yes, see c6ce5643aa4a95e49f5d4029bbe5502312ce8160 in particular bundles/org.eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css in which I did that for the tabs.
Comment 18 Rolf Theunissen CLA 2021-08-11 06:04:17 EDT
(In reply to Lars Vogel from comment #17)
> (In reply to Rolf Theunissen from comment #16)
> > For me this invisible selection is a blocker to use the dark theme.
> 
> We could change the hard-coded color to a colors which could be changed via
> the Colors and Fonts preferences. This way users which find the current
> selection contrast unacceptable at least change the preference. If yes, see
> c6ce5643aa4a95e49f5d4029bbe5502312ce8160 in particular
> bundles/org.eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css in
> which I did that for the tabs.

Having a configuration is fine, but sane defaults too. Have a look at the attachment 'Problem Image', contrast in inactive selection is next to zero. SWT currently does not allow to change the (inactive) selection color.
Comment 19 Lars Vogel CLA 2021-08-11 06:42:34 EDT
(In reply to Rolf Theunissen from comment #18)

> Having a configuration is fine, but sane defaults too.

I agree but the suggested color change does not look good (sane) to me. So as a starter we could make the background configurable, which would allow you and others to use the dark theme which hopefully would result in more improvement in the dark theme.

WDYT?
Comment 20 Zaheer Ahmad CLA 2021-08-11 09:27:57 EDT
Created attachment 286921 [details]
example from egit plugin

Hi, Guys if Egit plugin as ref can be taken i want to suggest as Eclipse User that it would be best to give user the option to change color of selected file for text and for background and even the Background of this whole Tree Area in Project Explorer.  So that User can adjust it as per Color Preference which suits their eyes.
Thanks for providing us this greate Java IDE.
Comment 21 Mike Marchand CLA 2021-10-19 15:09:56 EDT
Just as a potential clue, this is what we're doing in our product (ColorConstants is our own class).  

tree.addListener(SWT.EraseItem, (event) -> {
	if (tree.isFocusControl()) {
		return;
	}
				
	event.detail &= ~SWT.HOT;
	if ((event.detail & SWT.SELECTED) == 0) return; /* item not selected */
			
	int clientWidth = tree.getClientArea().width;
	GC gc = event.gc;
				
	gc.setForeground(ColorConstants.getColorByName(ColorConstants.FOREGROUND));
	gc.setBackground(ColorConstants.getColorByName(ColorConstants.UNFOCUSED_TREE_SELECTION_COLOR));
	gc.fillRectangle(0, event.y, clientWidth, event.height);
			
	event.detail &= ~SWT.SELECTED;
});

In the past Eclipse did have custom handlers for the drawing of tables and trees in the Platform UI... perhaps we could consider bringing part of that back for only the selection of unfocused trees.  We had two reasons for removing the custom drawing (SWT greatly improved dark theme support for win32 and there was an issue/bug where we had blurry text in trees that would appear in certain circumstances).  The old drawing code was removed here (https://git.eclipse.org/c/gerrit/platform/eclipse.platform.ui.git/commit/?id=2c89fdd76d5c26e0a1c48e36031a5d0e79a513fe).  It could be worth experimenting with only handling selected Tree elements for non-focused Trees.
Comment 22 Rolf Theunissen CLA 2021-10-20 03:36:23 EDT
(In reply to Mike Marchand from comment #21)
> In the past Eclipse did have custom handlers for the drawing of tables and
> trees in the Platform UI... perhaps we could consider bringing part of that
> back for only the selection of unfocused trees.  We had two reasons for
> removing the custom drawing (SWT greatly improved dark theme support for
> win32 and there was an issue/bug where we had blurry text in trees that
> would appear in certain circumstances).

For information, while messing around in the tree code, I noticed that one of the cases that you get blurry text is when text is drawn both by the default win32 API and the custom drawn. There is a 1px offset between them somewhere, which becomes visible as blurry text.
Comment 23 Mike Marchand CLA 2021-10-20 08:57:53 EDT
That's why I think it's safe to try having only the background drawn by the custom drawing.  I have only recently made the improvement in our product, but I have not seen a case of blurry text.
Comment 24 Zaheer Ahmad CLA 2021-11-12 05:43:42 EST
Each new Eclipse Release bring a very little on Dark Theme and in my personal opinion Dark Themes in general are more in use now in many IDEs.
Eclipse should also fix all small issues on it Dark Theme.
Thanks for Providing this great Software just my personal opinion
Comment 25 Adrian Faur CLA 2022-11-26 18:17:19 EST
I have spent one day just to fix this somehow. Tried everything from windows 10 registries to eclipse css files. Could not find any setting that will affect the eclipse project/package/explorer inactive background color for dark theme. This was/is not an issue on windows 7, default dark colors are distinctive (eclipse 3.9, eclipse 4.16). Not having selection visible on inactive tree makes it almost impossible to use dark themes. Please fix or offer a solution (where does this color comes from).