Add dark theme support for SeText-based text editors
I was thinking to try modeling NPC behavior in CIF last weekend, and thought the simplest would be to use an escet produkt.
So I grabbed a locally build ~/work/escet/dev/git/escet/product/org.eclipse.escet.product/target/products/eclipse-escet-incubation-dev-linux.gtk.x86_64.tar.gz
, extracted it, and started eclipse-escet
.
After typing a few lines it looks like
The CIF text is quite horrible to read to say the least. Apparently the build picked up my dark theme from the development eclipse (not sure how, as mvn
was building the binary from the command-line).
I couldn't find a way to fix this from the constructed eclipse program, you can set a theme it was set to "light" so it made less than sense :p
So I was thinking likely the problem originates from our cif/texteditor/CifStyles.java
class that defines foreground color but not background color. Hacking a background color into that fixed the text-part, but not the spaces left of the text, between the words, and after the text. The former two were fixable by adding an explicit background to the whitespace rule in cif/texteditor/CifTextEditorScanner.java
.
That fixes thus the text and spaces of the line itself, but not at the right towards the right hand side of the editor window, except for the ruler (the "current line" where the cursor is, the white horizontal white band at line 3 in the picture).
I have not been able to find a way to change the background in the styles. The editor seems to only care about handling the stored program text in the editor. I did find AbstractEditor.PREFERENCE_COLOR_BACKGROUND
and PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT
, no idea what the difference is between them. What to actually do with this value is not clear, as we don't even have preference settings it seems:
// org.eclipse.escet.setext.texteditorbase.GenericSourceViewerConfiguration
// line 84
public void setPreferenceStore(IPreferenceStore preferenceStore) {
Assert.check(fPreferenceStore == null);
fPreferenceStore = preferenceStore;
}
Note I have this also in my sub-eclipse, so it's not specific to a product.