Bug 543889 - [Mac] Window title bar should be dark when Eclipse is in dark theme
Summary: [Mac] Window title bar should be dark when Eclipse is in dark theme
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.10   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.11 M3   Edit
Assignee: Lakshmi P Shanmugam CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on: 459789 543932
Blocks: 544854
  Show dependency tree
 
Reported: 2019-01-28 06:03 EST by Lakshmi P Shanmugam CLA
Modified: 2019-05-02 00:57 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lakshmi P Shanmugam CLA 2019-01-28 06:03:53 EST
On Mac OS X the window title bar is not affected by switching Eclipse to the dark theme - it remains light.

Bug 459789 provides a method to set the OS theme which makes the title bar dark in dark theme.
Platform UI should call the method whenever there is a theme change.
Comment 1 Eclipse Genie CLA 2019-01-28 06:06:59 EST
New Gerrit change created: https://git.eclipse.org/r/135856
Comment 2 Lars Vogel CLA 2019-01-28 07:45:50 EST
Can't we simply use setColor? Theme are not either light or dark, they can use any color.
Comment 3 Alexander Kurtakov CLA 2019-01-28 08:17:44 EST
(In reply to Lars Vogel from comment #2)
> Can't we simply use setColor? Theme are not either light or dark, they can
> use any color.

No UI toolkit provides API to set color for window decorations because this is drawn by the desktop environment. If one wants to have full control over window decorations colors and etc. it has to be custom drawing which opens dozens of other projects and looks alien to the user. Furthermore this is what we do on Gtk too - see https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.e4.ui.swt.gtk/src/org/eclipse/e4/ui/swt/internal/gtk/DarkThemeProcessor.java which works only when the theme used has dark variant (which is not true for Ubuntu's one) .
Comment 4 Lakshmi P Shanmugam CLA 2019-02-01 06:17:19 EST
The patch changes the window title bar to dark in Dark Theme. 
It also affects other controls in Dark Theme:
1. Menu has dark background with white foreground
2. Caret is white in Text box
3. Caret, text, search and cancel icons are white in Search box
4. Text box in Combo is gray
5. Table/Tree inactive selected background color is gray and foreground is white
6. Text selection color in Text box/Combo is now darker, making the selected text visible.

The changes look fine so far in my testing.

Till/Matthias, I'll be great if you can test the patch on Mac. Please use the latest build as it has the required SWT changes.
Comment 5 Matthias Becker CLA 2019-02-01 06:25:23 EST
(In reply to Lakshmi Shanmugam from comment #4)
> Till/Matthias, I'll be great if you can test the patch on Mac. Please use
> the latest build as it has the required SWT changes.

The latest i-build?
Comment 6 Lakshmi P Shanmugam CLA 2019-02-01 06:28:57 EST
(In reply to Matthias Becker from comment #5)
> (In reply to Lakshmi Shanmugam from comment #4)
> > Till/Matthias, I'll be great if you can test the patch on Mac. Please use
> > the latest build as it has the required SWT changes.
> 
> The latest i-build?

Yes, please test using latest I-build (I20190131-1800) + gerrit change in this bug.
Comment 7 Till Brychcy CLA 2019-02-01 07:00:26 EST
I'm already using it for a few days now and it is great.

The only minor issue I noted so far is that the text color in Combo widgets isn't optimal - it is black when the menu is not shown and some gray when the menu is shown (which looks a bit like the items are disabled), but should be white in both cases (at least that is how it is in native applications)
Example: Theme combo in Preferences > General > Appearance.

This shouldn't stop us from releasing this, though :-)

BTW, I wonder if we could just disable styling the widgets in dark mode and just use the native dark look of buttons etc.
Comment 8 Lakshmi P Shanmugam CLA 2019-02-01 07:35:19 EST
Thanks for trying it out, Till!
I initially thought only the window title bar would be affected but all the widgets are affected.

(In reply to Till Brychcy from comment #7)
> I'm already using it for a few days now and it is great.
> 
> The only minor issue I noted so far is that the text color in Combo widgets
> isn't optimal - it is black when the menu is not shown and some gray when
> the menu is shown (which looks a bit like the items are disabled), but
> should be white in both cases (at least that is how it is in native
> applications)
> Example: Theme combo in Preferences > General > Appearance.
I agree that the items look like they are disabled. Will open a bug for this.
 
> BTW, I wonder if we could just disable styling the widgets in dark mode and
> just use the native dark look of buttons etc.
May we could try this, at least for widgets like Button, Table/Tree (to get the alternating dark background lines). Will open a bug for this.
Comment 10 Matthias Becker CLA 2019-02-01 07:57:51 EST
I also did a quick test. Looks so much better.
Good job!!!

One think I noticed:
I have to enable dark mode in macOS *and* in eclipse to make this work.
Wouldn't it be a good idea to automatically switch to the dark theme when we notice that macOS is running in dark mode?
Comment 11 Lakshmi P Shanmugam CLA 2019-02-01 08:13:16 EST
Thanks for testing, Matthias!

(In reply to Matthias Becker from comment #10)
> I also did a quick test. Looks so much better.
> Good job!!!
> 
> One think I noticed:
> I have to enable dark mode in macOS *and* in eclipse to make this work.
> Wouldn't it be a good idea to automatically switch to the dark theme when we
> notice that macOS is running in dark mode?

We started in that direction in Bug 540357 but there were other issues to be fixed. We plan to continue working on that.
Comment 12 Lakshmi P Shanmugam CLA 2019-02-01 08:14:46 EST
(In reply to Lakshmi Shanmugam from comment #8)
> > The only minor issue I noted so far is that the text color in Combo widgets
> > isn't optimal - it is black when the menu is not shown and some gray when
> > the menu is shown (which looks a bit like the items are disabled), but
> > should be white in both cases (at least that is how it is in native
> > applications)
> > Example: Theme combo in Preferences > General > Appearance.
> I agree that the items look like they are disabled. Will open a bug for this.
Opened Bug 544041

> > BTW, I wonder if we could just disable styling the widgets in dark mode and
> > just use the native dark look of buttons etc.
> May we could try this, at least for widgets like Button, Table/Tree (to get
> the alternating dark background lines). Will open a bug for this.
Opened Bug 543889
Comment 13 Lakshmi P Shanmugam CLA 2019-02-04 03:58:57 EST
(In reply to Lakshmi Shanmugam from comment #12)
> > > BTW, I wonder if we could just disable styling the widgets in dark mode and
> > > just use the native dark look of buttons etc.
> > May we could try this, at least for widgets like Button, Table/Tree (to get
> > the alternating dark background lines). Will open a bug for this.
> Opened Bug 543889

Sorry, it's Bug 544039.
Comment 14 Lakshmi P Shanmugam CLA 2019-02-20 01:14:59 EST
Verified in I20190218-1800.

Thanks Alex for the initial pointers on how to get this working.
Comment 15 Alexander Kurtakov CLA 2019-02-20 02:55:04 EST
(In reply to Lakshmi Shanmugam from comment #14)
> Verified in I20190218-1800.
> 
> Thanks Alex for the initial pointers on how to get this working.

You're welcome.
Comment 16 Thomas Singer CLA 2019-04-29 10:12:47 EDT
How to use this approach simply from SWT (without other Eclipse dependencies)?
Comment 17 Lakshmi P Shanmugam CLA 2019-05-02 00:57:53 EDT
(In reply to Thomas Singer from comment #16)
> How to use this approach simply from SWT (without other Eclipse
> dependencies)?

In 4.12, SWT applications on Mac will automatically launch in dark or light theme based on the System appearance when the system property org.eclipse.swt.display.useSytemTheme is set to true. (Bug 540357)