boothen / Json-Eclipse-Plugin

A fork from the json editor on sourceforge
Eclipse Public License 1.0
64 stars 20 forks source link

Support default colors for dark theme #24

Open de-jcup opened 5 years ago

de-jcup commented 5 years ago

The default font colors are suitable for light theme but there seems to be no defaults for dark theme. When installing the plugin fresh from marketplace to a dark theme eclipse (4.11) it looks very bad:

image

I would suggest to provide either a dedicated defaults button in preferences or to provide a css file for dark theme support (e4 style).

Here my suggestions for a good looking defaults:

image

image

msteiger commented 5 years ago

How do you configure the color theme? Do you use the eclipse theme plugin?

If so, it looks like a duplicate of #21 - can you confirm?

de-jcup commented 5 years ago

It seems #21 is some sort of duplicate her. But with some differences:

The eclipse theme plugin is dead - as you mentioned in #21

But eclipse 4.x provides its own theme mechanism done by css. Please look at https://github.com/de-jcup/eclipse-asciidoctor-editor/pull/63/commits/be24fb4c87b964edef48613c561f1bb8e031c087 where Lars Vogel did provide a css template for asciidoctor editor.

I think you can use this commit as working example.

de-jcup commented 5 years ago

For common defaults you can also reuse current colors by code see https://github.com/de-jcup/eclipse-asciidoctor-editor/issues/70

We had this in the past also in Platform but fixed that with https://bugs.eclipse.org/bugs/show_bug.cgi?id=517393 I think you should be able to get the correct color via:

JFaceResources.getColorRegistry().JFacePreferences.HYPERLINK_COLOR); JFaceResources.getColorRegistry().JFacePreferences.ACTIVE_HYPERLINK_COLOR);

de-jcup commented 5 years ago

Please be aware about my comment at https://github.com/de-jcup/eclipse-asciidoctor-editor/issues/174#issuecomment-462060474 and how the css setup is applied...

msteiger commented 5 years ago

Thanks for the hint. I will dig it into, but might need a few days for that.

msteiger commented 5 years ago

I've spent a bit of time on this and configured the CSS for the dark theme, but it doesn't seem to get picked up by the preference store. https://github.com/boothen/Json-Eclipse-Plugin/commit/ac8d179a7d935af905bdeec73f0b54f75c7e6194

Is the name of the "pseudo attribute" important? The JsonTokenStyler uses the PreferenceStore of the TextSourceViewerConfiguration to get the colors.

Maybe my minimal runtime is too old? It currently uses org.eclipse.ui.editors_3.10.0.v20160505 and org.eclipse.e4.ui.css.swt.theme_0.10.100.v20160523 ...

de-jcup commented 5 years ago

I have also some issues with the new theme. Sometimes it works sometimes not... a little bit frustrating... see asciidoctor-editor#185

Also the "Restore defaults" button in preferences works not correctly when dark theme is activate... seems to be an older and wellknown bug in eclipse: https://bugs.eclipse.org/bugs/show_bug.cgi?id=478835

I end up with supporting a "Restore defaults for dark theme" button - see https://github.com/de-jcup/eclipse-bash-editor/wiki/FAQ#how-to-apply-default-dark-theme-colours for an example.

I will try to provide the theme color css as well, so if this is fixed/initial the colors should automatically apepar.

So my suggestion would be to add a "Restore defaults for dark theme" button in your preferences ... Works always.

PyvesB commented 5 years ago

The defaults do work very badly with the dark theme. Just hit this problem today.

fkrivsky commented 4 years ago

This issue is still present...

msteiger commented 4 years ago

Yes, I could not find a good way to fix this. The eclipse default color support does not work as I expected and I couldn't find proper documentation or examples for it. Even with the ascii-doctor source code, I could not get it to work properly. If someone knows how to do it, a PR would be highly appreciated.