Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-dev] Display.getSystemColor() returns different color in Dark Theme depending on when it is called

Hi Alois,

That would be desirable.

As we currently need an IEclipseContext for the initialization of the
styling we would have to wait with the initialization until the
context is created, looking at the code it seems that earliest would
be Workbench#createAndRunWorkbench Line 577.
Or we could try to persist the CSS styling as a workspace preference
and re-apply it at startup.

Please open a bug for this so that we can start looking into it.

Best regards, Lars

On Sun, Dec 19, 2021 at 7:00 PM Alois Zoitl <alois.zoitl@xxxxxx> wrote:
>
> Hi,
>
> I hope I'm at the right place for my question.
>
> I'm working on the Eclipse 4diac project and there we have an RCP utilizing the org.eclipse.ui.ide.workbench as main application. Once in a while I'm
> experimenting with switching it int dark mode. However certain widgets always got not the correct color even after restart. I may have to add here that we are
> using a lot GEF3 which is not visible in the E4 model and therefore to my knowledge currently not to address from CSS.
>
> What I somehow noticed is that in these editors I also use the Display.getSystemColor() as an easy way to get to certain widget colors. And that when an editor
> was open and Eclipse is restarted I get from getSystemColor() the color from the light (default) theme. However when I closed the editor and reopend it I
> suddenly got the dark theme's color and everything looked right.
>
> So this got me curios and I dug deeper. I could find out that initializeSystemColors() is called twice. The first time it sets up the system colors with the
> default (light) theme's colors. the second time with the dark theme.
>   - the first time happens when the Display is created by the Workbench a part of the IDEApplications start up procedure
>   - the second time when the workbench is created and run and there the renderer is created
>
> The problem now is that the second time happens when all views are already created. Therefore older code like GEF3 based code will have at that time already the
> colors from the first invocation. While for my code I could rather easy manage to get the right colors it is harder for the GEF3 code. Because there the colors
> are stored as static final fields once and these colors are then used all over the place. This would be a major refactor which I'm currently not sure if this is
> even easily possible.
>
> Therefore I'm asking if there is a possibility to get the renderer created earlier or that the system colors are only set once in the beginning. This would not
> only help to better support the dark theme for Eclipse 4diac but for any GEF3 and with that GMF, Sirius, and Graphiti based RCP.
>
> Thanks in advance,
> Alois
>
> _______________________________________________
> platform-dev mailing list
> platform-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/platform-dev



-- 
Eclipse Platform project co-lead
CEO vogella GmbH

Haindaalwisch 17a, 22395 Hamburg
Amtsgericht Hamburg: HRB 127058
Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
USt-IdNr.: DE284122352
Fax (040) 5247 6322, Email: lars.vogel@xxxxxxxxxxx, Web: http://www.vogella.com


Back to the top