On Sun, 27 Jul 2025 18:46:46 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
>> Currently, the color scheme of a system-decorated stage is as follows: >> * On Windows, the title bar is always light (even if the OS color scheme is >> dark). >> * On macOS and Linux, the title bar is light or dark depending on the OS >> color scheme. >> >> The expected behavior is that the title bar matches the color scheme of the >> `Scene`. >> If an application doesn't specify a color scheme, the title bar color should >> match the OS color scheme. >> >> This PR fixes the behavior for Windows and macOS, but not for Linux (there's >> no good way to do that). >> Depending on how you look at it, this is either a bug fix or an enhancement. > > Michael Strauß has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains two commits: > > - Merge branch 'master' into feature/dark-window-frame > > # Conflicts: > # modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m > - Window decorations adapt to color scheme > Is the extra code (beside looking at the version) so that I can toggle the > darkbar from Java? We have two places in JavaFX that are relevant to dark mode: 1. `Platform.Preferences.colorScheme`, which tells you the color scheme of the operating system (i.e. what you select in PC settings) 2. `Scene.Preferences.colorScheme`, which defaults to the OS color scheme, but is overridable for each scene. This PR proposes to match the OS-provided title bar color to the value of `Scene.Preferences.colorScheme`, which allows developers to choose how their application should be presented: * If you don't override the scene color scheme, the window title bar will match the OS by default (light or dark). * However, if your application uses a fixed light or dark theme (i.e. it doesn't adapt its control theme colors to dark mode), then overriding the scene color scheme ensures consistent presentation independent of OS settings. ------------- PR Comment: https://git.openjdk.org/jfx/pull/1845#issuecomment-3218222926