Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] Enabling dark theme support for SWT stand-alone applications on Windows

Hi Paul,

here is what we do: https://github.com/eclipse-platform/eclipse.platform.ui/blob/master/bundles/org.eclipse.e4.ui.swt.win32/src/org/eclipse/e4/ui/swt/internal/win32/DarkThemeProcessor.java

In addition to that we also use the CSS engine to style everything. See https://github.com/eclipse-platform/eclipse.platform.ui/blob/master/bundles/org.eclipse.ui.themes/css/e4-dark_win.css

IIRC in pure SWT apps you will have to style your widgets using the regular SWT API, I primary work with RCP clients for which we use the CSS engine.

Best regards, Lars



Best regards, Lars

On Thu, Jan 12, 2023 at 3:44 PM Paul Gardner <gardnerpar@xxxxxxxxx> wrote:

I have a stand-alone SWT application (BiglyBT, https://github.com/BiglySoftware/BiglyBT) that runs with a dark theme on Linux and OSX just fine. However, on Windows I am stuck trying to figure out how to do this.

I've been following the [Win32][DarkTheme]... discussions on Bugzilla for a while, and see that the Eclipse IDE itself is working well with a dark theme on Windows 10/11, so it seems to me that SWT support is pretty complete.

As an example, what would I need to do to get

    java -classpath swt.jar org.eclipse.swt.examples.controlexample.ControlExample

to run with a dark theme? If I add

    OS.setTheme(true);

to the main method and run with SWT 4956r13 I end up with the attached.

If I understand the comment in setTheme correctly ( "just some tweaks to tailor things that SWT can't color properly" ) then all I am seeing are the tweaks and the underlying SWT controls are not picking up the theme at all.

Kind regards,

Paul


_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/eclipse-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