[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: RFR: 8301302: Platform preferences API [v2]
From:       Michael =?UTF-8?B?U3RyYXXDnw==?= <mstrauss () openjdk ! org>
Date:       2023-01-31 23:42:56
Message-ID: o4M5O60SF7ob_9Pv333qXTA085DxTcnMt3Ge0faMwO0=.a5146998-25d5-42df-be42-1c26618c8d1f () github ! com
[Download RAW message or body]

On Tue, 31 Jan 2023 23:07:12 GMT, Andy Goryachev <angorya@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic