Dark Mode

VAqua supports the dark appearance introduced in macOS 10.14, also known as dark mode. Dark mode changes the rendering of all platform components; however, to effectively support dark mode in an application, additional changes to the application are likely to be required.

See screen shots.

An application that uses VAqua automatically uses the current system appearance selected by the user. Alternatively, an application can request a specific appearance by setting a system property:

-Dapple.awt.application.appearance=NSAppearanceNameAqua
-Dapple.awt.application.appearance=NSAppearanceNameDarkAqua

This property can be set on the command line, as illustrated, using JVMOptions in an Info.plist file, or at runtime (as long as it is set before AWT/Swing is initialized).

When using the system appearance, VAqua automatically updates the display when the system appearance is changed. It also updates the display when the accent color is changed, or the high contrast accessibility option is changed.

Customizing your application

For many apps, additional customization will be needed. Apple has a document that illustrates the kinds of changes that might be needed, such as selecting colors and creating icons to use in dark mode, but the technology it describes is not available to Java applications.

Applications can obtain appearance information for a window or a component subtree using the AppearanceSupport class provided by the client library.

Specifying an appearance

Normally, each window inherits an appearance from its parent window or the application, and each component inherits its appearance from its parent component or its window. In certain cases, you may wish to force a given window or component subtree to use a specific appearance. For example, when displaying user editable text content, you may prefer to use the light appearance (black text on a white background) even in dark mode.

To specify an appearance for a window, set the client property Aqua.appearanceName on the root pane of the window.

To specify an appearance for a component subtree, root the subtree in a JAppearancePanel and set the client property Aqua.appearanceName on that component. JAppearancePanel is a slightly extended JPanel provided by the client library. It paints an appropriate background when its appearance differs from its parent component’s appearance.

The available appearance names are defined by macOS: