Dark theme support for Xtext editor [message #1818484] |
Tue, 17 December 2019 04:00  |
Eclipse User |
|
|
|
Hi,
I'd like to automatically change the colors used by the editor when Eclipse IDE is in dark theme (similar to what is done by JDT).
According to this page [1] (see "Guide for plug-in developers to contribute to the default dark theme") we can contribute to the org.eclipse.e4.ui.css.swt.theme extension point to specify some preferences that should be used when the dark theme is activated, so we should be able to change the colors used by Xtext.
I hence created the following extension:
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<stylesheet
uri="css/dark-theme.css">
<themeid
refid="org.eclipse.e4.ui.css.theme.e4_dark">
</themeid>
</stylesheet>
</extension>
that links the following CSS file:
IEclipsePreferences#xtext-preferences-node-for-MyDsl:mydsl-ui-themes { /* pseudo attribute added to allow contributions without replacing this node, see Bug 466075 */
preferences:
'xtext.preferences.node.for.MyDsl.syntaxColorer.tokenStyles.MethodDefinition.color=255,255,0'
'xtext.preferences.node.for.MyDsl.syntaxColorer.tokenStyles.MethodDefinition.style=1073741824'
}
Sadly it has no effect.
I believe that the CSS file is taken into account because if I change the extension to point to a non existing file an error is shown. I also belive that I used the right preferences node ("xtext.preferences.node.for.MyDsl" is just a placeholder here).
I don't know the internals of the CSS engine so I don't know if the issue comes from me, Xtext, the JFace editor or anything else. And before I spend hours digging into the debugger I'd like to know whether some of you tried (and succeeded?) to add such a dark theme to their Xtext editor.
[1] https://www.eclipse.org/community/eclipse_newsletter/2018/june/darktheme.php#guide-for-plug-in-developers-to-contribute-to-the-default-dark-theme
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05350 seconds