Bug 532185 - [Dark Theme] Help content does not respect styling
Summary: [Dark Theme] Help content does not respect styling
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.13 M1   Edit
Assignee: Matthias Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2018-03-08 10:08 EST by Matthias Becker CLA
Modified: 2019-08-20 07:15 EDT (History)
5 users (show)

See Also:


Attachments
Screencast showing the issue (86.50 KB, image/png)
2018-03-08 10:08 EST, Matthias Becker CLA
no flags Details
Old and new next to each other in the dark theme (1.13 MB, image/png)
2019-04-18 03:37 EDT, Matthias Becker CLA
no flags Details
Old and new next to each other in the dark theme (1.15 MB, image/png)
2019-04-18 03:38 EDT, Matthias Becker CLA
no flags Details
New version in light appearance (789.37 KB, image/png)
2019-04-18 03:40 EDT, Matthias Becker CLA
no flags Details
new version in dark appearance but in a browser not supporting it (843.87 KB, image/png)
2019-04-18 03:42 EDT, Matthias Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Becker CLA 2018-03-08 10:08:20 EST
Created attachment 273041 [details]
Screencast showing the issue

When ever a help content document is displayed it uses a fixed styling (light background and dark foreground). In the dark theme is is quite bad.
See the attached screenshot.
The background and foreground colors should be adapted according to the currently active theme.
Comment 1 Matthias Becker CLA 2018-03-26 09:26:52 EDT
As far as I see the help content is served by jetty from the plugins that contribute help content. Typically this help content is a set of HTML files along with the corresponding CSS files. These CSS files do not know anything about the current theme in eclipse.

Can somebody point me to a place in the code where jetty pics up this content and serves it?
Comment 2 Matthias Becker CLA 2018-03-26 09:44:34 EDT
One additional question?
How is the Eclipse Help Content (e.g. for Platform or JDT) produced. Is there Content Management System in use?
Comment 3 Dani Megert CLA 2018-03-26 12:06:54 EDT
(In reply to Matthias Becker from comment #2)
> One additional question?
> How is the Eclipse Help Content (e.g. for Platform or JDT) produced. Is
> there Content Management System in use?

Manually writing/editing html files in the doc plug-ins.
Comment 4 Matthias Becker CLA 2018-03-27 02:39:30 EDT
(In reply to Dani Megert from comment #3)
> Manually writing/editing html files in the doc plug-ins.
And so are the CSS files?
Comment 5 Dani Megert CLA 2018-04-05 08:04:16 EDT
(In reply to Matthias Becker from comment #4)
> (In reply to Dani Megert from comment #3)
> > Manually writing/editing html files in the doc plug-ins.
> And so are the CSS files?

There aren't that many CSS files. Most of them are copies.
Comment 6 Matthias Becker CLA 2019-03-28 02:58:28 EDT
I just stumbled over Safaris new support for dark mode in macOS Mojave 10.14.4.
The important part is: "Adds Dark Mode support for websites that support custom color schemes " see : 
https://www.macrumors.com/2019/03/25/apple-releases-macos-mojave-10-14-4/
https://kevinchen.co/blog/support-macos-mojave-dark-mode-on-websites/
https://davidwalsh.name/prefers-color-scheme

The solution is to have a new CSS media query called "prefers-color-scheme". This is quite now as you can see on:
https://caniuse.com/#search=prefers-color-scheme

But maybe this is the way we should also go with the documentation. Maybe it's too early to implement it at the moment.
Comment 7 Eclipse Genie CLA 2019-04-18 03:27:56 EDT
New Gerrit change created: https://git.eclipse.org/r/140803
Comment 8 Eclipse Genie CLA 2019-04-18 03:28:41 EDT
New Gerrit change created: https://git.eclipse.org/r/140804
Comment 9 Eclipse Genie CLA 2019-04-18 03:32:01 EDT
New Gerrit change created: https://git.eclipse.org/r/140805
Comment 10 Matthias Becker CLA 2019-04-18 03:37:31 EDT
Created attachment 278324 [details]
Old and new next to each other in the dark theme

On top you see the new appearance with all 3 changes.
Comment 11 Matthias Becker CLA 2019-04-18 03:38:53 EDT
Created attachment 278325 [details]
Old and new next to each other in the dark theme

This shows the situation without https://git.eclipse.org/r/#/c/140805/
You see the grey separators and the grey separator between left and right area
Comment 12 Matthias Becker CLA 2019-04-18 03:40:04 EDT
Created attachment 278326 [details]
New version in light appearance

With my changes (but without https://git.eclipse.org/r/#/c/140805/) in light appearance.
You see that it looks just the same as the current version
Comment 13 Matthias Becker CLA 2019-04-18 03:42:37 EDT
Created attachment 278327 [details]
new version in dark appearance but in a browser not supporting it

Here the OS is set to dark appearance but now the documentation is shown in google chrome. Chrome does not (yet) support the new media query. So the content is shown as
it would be in light appearance. Once Chrome adds support for the new media query this will also reander in dark appearance without any change needed
Comment 14 Matthias Becker CLA 2019-04-18 03:49:02 EDT
When the help content is displayed in the external browser the system preferences about system wide dark or light appearance should be respected.

There's a CSS standard coming for this: the prefers-color-scheme media query (see https://drafts.csswg.org/mediaqueries-5/#prefers-color-scheme ).

The CSS of the help content should incorporate this media query.

Up to now only Firefox 67 and Safari 12.1 implement this (see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme).

The appearance of the documentation in the light appearance and in a browser not supporting the media query stays unchanged.

This needs to be tested on various platforms and browsers.

I know that there are still some pictures in the actual help content (e.g. in org.eclipse.platform.doc.user) that needs to be adapted (e.g removing white borders) but this can be done in separate commits. Anyway when using OS-wide dark appearance this is already much better than the current state.


My changes only affect the display of the help in the extern browser. The display in the SWT help view still needs to be adapted. But maybe can leverage the same media-query by telling the SWT browser widget to use the "dark" color-scheme when OS or Elcipse is in dark mode. I haven't looked into this topic. Maybe one of the SWT experts may have a look at this topic.
Comment 15 Alexander Kurtakov CLA 2019-04-18 10:56:30 EDT
So do I get it right that in order to see the dark help I need to render it webengine that supports this media query? My webkit2gtk3 2.24.1 doesn't seem to support it?
Comment 16 Matthias Becker CLA 2019-04-18 10:57:55 EDT
(In reply to Alexander Kurtakov from comment #15)
> So do I get it right that in order to see the dark help I need to render it
> webengine that supports this media query? My webkit2gtk3 2.24.1 doesn't seem
> to support it?

Yes. That's right. See the link which browsers currently support it.
Comment 17 Alexander Kurtakov CLA 2019-04-18 11:01:18 EDT
I can confirm that I don't see any change on firefox 66 (latest stable release) and webkitgtk 3.24.1. More than that is not testable for me yet so it's your call on this one.
Comment 18 Matthias Becker CLA 2019-04-18 11:13:03 EDT
(In reply to Alexander Kurtakov from comment #17)
> I can confirm that I don't see any change on firefox 66 (latest stable
> release) and webkitgtk 3.24.1. More than that is not testable for me yet so
> it's your call on this one.

a test on windows with IE and Edge would also be good to have.
@Windows-User to the front...
Comment 19 Sebastian Ratz CLA 2019-06-18 09:50:55 EDT
I tested the changes on Windows:

In IE11, Edge, and Chrome 75, which do not support "prefers-color-scheme", it still looks like before.

In Firefox 67, which does support "prefers-color-scheme", the dark theme is correctly applied according to Windows Settings -> Personalization -> Colors -> Choose your app default mode.
Comment 20 Lars Vogel CLA 2019-06-18 10:06:17 EDT
(In reply to Sebastian Ratz from comment #19)
> I tested the changes on Windows:
> 
> In IE11, Edge, and Chrome 75, which do not support "prefers-color-scheme",
> it still looks like before.
> 
> In Firefox 67, which does support "prefers-color-scheme", the dark theme is
> correctly applied according to Windows Settings -> Personalization -> Colors
> -> Choose your app default mode.

Cool, please merge changes.
Comment 21 Matthias Becker CLA 2019-06-19 09:45:23 EDT
I plan to merge the linked changes by the end of this week.
Comment 22 Eclipse Genie CLA 2019-06-26 07:26:43 EDT
New Gerrit change created: https://git.eclipse.org/r/144921
Comment 26 Matthias Becker CLA 2019-06-26 08:00:13 EDT
(In reply to Eclipse Genie from comment #22)
> New Gerrit change created: https://git.eclipse.org/r/144921

can someone with commit rights in epp/org.eclipse.epp.packages review and merge this?
Comment 27 Matthias Becker CLA 2019-06-26 08:22:01 EDT
(In reply to Lars Vogel from comment #20)
> Cool, please merge changes.

(mostly) done.
With this the help content is styled correctly in the external browser (when the browser does support that new media query).

The CSS used for the display in the internal help view also has the necessary media query but this has no effect.

Can SWT browser somehow tell the native embedded browser to use the dark prefers-color-scheme? How can we address this?
Comment 29 Alexander Kurtakov CLA 2019-07-04 02:42:06 EDT
Is there anything pending here?
Comment 30 Matthias Becker CLA 2019-07-04 02:58:24 EDT
(In reply to Alexander Kurtakov from comment #29)
> Is there anything pending here?

Up to now only the help display in the external browser is fixed. The display in the help view does not yet respect the dark mode. We could handle this in a separate bug.
Comment 31 Eclipse Genie CLA 2019-08-06 07:29:40 EDT
New Gerrit change created: https://git.eclipse.org/r/147101
Comment 33 Eclipse Genie CLA 2019-08-20 07:02:17 EDT
New Gerrit change created: https://git.eclipse.org/r/147982