Automatic dark mode detection (JDK-8235460) - POC
axh
axh at dua3.com
Thu Oct 30 17:22:46 UTC 2025
Hi,
I hope this is the right place to ask - I would comment in the bug tracker if getting a login there weren’t harder than entering Fort Knox. If this should be posted to another list, please let meknow.
I have written a POC for dark mode detection that works on Windows, MacOS, and Linux. It is 100% Java, calling native code through FFM, so Java 25 is required. It can detect the current system setting, and also tracks system changes.
I have released the POC under the GPL V2 with classpath exception to make it compatible with OpenJDK/JavaFX licensing.
Needs Java 25 and JavaFX correctly set up on your system (JavaFX is only needed because of the JavaFX sample application). No external libraries are needed (in the POC, I changed logging to use the system logger).
Legal thought
- I have used web search to find out how to detect and listen to system changes.
- I have also used AI to implement the necessary calls using FFM as I don’t yet have much experience with it. As everything is quite straight forward (follows established well documented practice for the platform) and the AI mainly helped me to put it into a FFM compatible form, I think there is no risk to inadvertently touch any third party copyright issues. I just want to mention that in case it is seen as a problem
The POC is available on GitHub: https://github.com/xzel23/darkmodedetector
Please let me know if this would be an acceptable contribution, and if so, how to proceed.
Axel
PS: Sorry to the mods, I accidentally used the wrong sender previously.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jdk-dev/attachments/20251030/955b2ec1/attachment.htm>
More information about the jdk-dev
mailing list