B4J Question Dark Mode on Win / Mac / Linux?

Markus Winter

Member
Licensed User
Ok, I searched for 5 min but haven't found an answer, so time for a new thread:

How do I support light and dark mode on the DESKTOP?

TiA

Markus
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
How do I support light and dark mode on the DESKTOP?
I've found this open source project, which allows detecting the current theme: https://github.com/Dansoftowner/jSystemThemeDetector
Its dependencies are a bit complex. I tested it on Windows and Mac and it works (there are errors on Mac in the logs but it still works).

1. Download the required jars: www.b4x.com/files/jSystemThemeDetector.zip and put them in the additional libraries folder.
2. See the attached example. Don't miss the #AdditionalJars and #PackagerProperty.

You will need to handle the color changes yourself. A complex example, which changes the theme in B4A and B4i, is available here: https://www.b4x.com/android/forum/t...todon-pleroma-social-networks.124214/#content
The same code will work in B4J.
In that project I've used this tool to create the color palettes: https://www.b4x.com/android/forum/threads/dark-light-color-palette.114513/#content


UuxYj4xr2I.gif
 

Attachments

  • Test.zip
    2.3 KB · Views: 110
Last edited:
Upvote 0
Top