JDK-8235363 : [macOS] Dark mode for the desktop is not supported
  • Type: CSR
  • Component: client-libs
  • Sub-Component: java.awt
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 14
  • Submitted: 2019-12-04
  • Updated: 2019-12-06
  • Resolved: 2019-12-06
Related Reports
CSR :  
Description
Summary
-------

In jdk13 we started to use macOS SDK 10.14 to build JDK, which automatically opts-in to support of dark mode,
but the Swing Aqua L&F does not work properly if dark mode is enabled on the macOS desktop.

Problem
-------

- Dark mode is a desktop appearance that is primarily dark which is intended to reduce power consumption by the display. 
- The macOS JavaRuntimeSupport (JRS) Framework which is used by the Swing Aqua L&F to draw the "native"
  appearance does not provide "dark mode" appearance, and a bug is filed with Apple :
  https://bugs.openjdk.java.net/browse/JDK-8228555.
- In a few places, we mix the "native" colors provided by the system (JRS) and default colors
  used by Swing. For example, we may use a transparent white selection "native"
  color which is invisible on top of white text fields. 

Solution
--------

Until the bugs above are fixed we should by default opt-out of dark mode,
and provide a way for application developers to opt-in this mode if needed 

Specification
-------------
A new system property is added: "apple.awt.application.appearance" to set the appearance of the whole java application.

 - If no value is set then light mode will be used
 - if "system" value is set then the current appearance of the macOS will be used
 - Other possible values are "NSAppearanceNameAqua" (the same as light), or
"NSAppearanceNameDarkAqua" (requesting dark)
See  https://developer.apple.com/documentation/appkit/nsappearancenameaqua?language=objc
 - If an incorrect value is set then light mode will be used
Comments
Moving to Approved.
06-12-2019

ok. i looked into webrev.1 not knowing there is webrev.2
05-12-2019

It is there: https://mail.openjdk.java.net/pipermail/awt-dev/2019-October/015435.html
05-12-2019

I could not see the system property apple.awt.application.appearance being added in the webrev.
05-12-2019