On Mon, 16 Feb 2026 17:11:01 GMT, Michael Strauß <[email protected]> wrote:

>> When a non-opaque scene fill color is used with a stage style other than 
>> `StageStyle.TRANSPARENT`, the actual fill color is always white. This 
>> doesn't work well when the scene uses a dark color scheme. A practical 
>> solution is to allow non-opaque scene fill colors, and blend them on top of 
>> a white or black background (depending on color scheme) to derive an opaque 
>> color that adapts intuitively to the color scheme.
>> 
>> To test this, simply create a scene that uses a non-opaque fill color and 
>> observe the scene background when the color scheme is changed.
>> 
>> This PR includes a system test, run it with:
>> 
>> ./gradlew -PFULL_TEST=true -PUSE_ROBOT=true :systemTests:test --tests 
>> test.robot.javafx.scene.SceneFillTest.testSceneFill
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   import

That PR might be missing some common cases. For example, a developer may want 
the scene's fill color to track the background color in PlatformPreferences. 
When that pref changes and becomes the new fill we should make sure the color 
(which is opaque) gets sent on to the OS.

It also bothers me that a developer has to rely solely on our built-in 
heuristics when the scene's fill is an image. What if a developer wants to 
specify a better color directly? Would it make sense to add a field to 
ImagePattern (perhaps using the heuristic in this PR as a fallback)? Or maybe 
provide a public API for setting the window's background color independently of 
the scene's fill?

I like that this PR tries to make JavaFX apps look good by default but we 
should at least think about providing API's so a motivated developer can solve 
the problem directly and not rely on our heuristics.

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

PR Comment: https://git.openjdk.org/jfx/pull/2068#issuecomment-4121221719

Reply via email to