RFR: 8377426: Adjust scene background to color scheme

Martin Fox mfox at openjdk.org
Wed Feb 11 17:29:25 UTC 2026


On Tue, 10 Feb 2026 20:38:42 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> In the dark mode, I do see the screen flickering to white before going to the set color, using the same test with lighter color:
> 
> ```
>         sc.setFill(Color.rgb(255, 255, 255, 0.2));
> ```

Good catch. When the stage is first shown JavaFX takes the scene's fill color and passes it off to the OS to become the window's background color. In the process it throws away the alpha component so here it's setting the background to white. That's what you'll see between the time the window is first made visible and when the rendering thread delivers pixels to the window. You'll also see flashes of the background color while resizing the window. See the calls to platformWindow.setBackground in WindowStage.java.

The Windows code throws this information away. macOS and Linux forward the color on to the platform. Fun fact: you can use this feature to tint the title bar on macOS.

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

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


More information about the openjfx-dev mailing list