On Tue, 31 Jan 2023 23:07:12 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

> I think that, by default, the FX frame decorations should pick up the 
> platform theme (dark, light, accent color, etc.). It should be possible to 
> override this behavior somehow - possibly by setting the base/accent color - 
> but using an enum for this purpose feels unnecessary.

I think it shouldn't do that automatically, because the default themes do not 
support a dark mode out of the box. _No_ theme will support multiple 
appearances without being specifically designed to do so.

If a theme supports multiple appearances, the "just use the platform 
appearance" behavior only requires a single line of code, which also takes care 
of macOS's "auto" appearance:


    var stage = new Stage();
    
stage.appearanceProperty().bind(Platform.getPreferences().appearanceProperty());


By the way, `Stage.appearance` doesn't really have anything to do with 
`StyleTheme`. A style theme is the proposed collection of stylesheets that 
define the look of a JavaFX application, while the stage appearance _only_ 
determines the appearance of native window decorations.

On Windows, the dark appearance adds the `DWMA_USE_IMMERSIVE_DARK_MODE` flag to 
the native window (see [Support Dark and Light themes in Win32 
apps](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes)),
 on macOS it chooses the "DarkAqua" appearance instead of the "Aqua" appearance 
(see [Choosing a Specific Appearance for Your macOS 
App](https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_macos_app)).
 There is no middle ground, it's either dark or it's not. Therefore I think the 
enumeration is a useful representation of this distinction.

-------------

PR: https://git.openjdk.org/jfx/pull/1014

Reply via email to