On Wed, 29 Apr 2026 08:15:55 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 two additional > commits since the last revision: > > - Refactor and remove clustering heuristics > - Composite over background in linear RGB I've refactored the dominant-color algorithm to hopefully make it easier to review: 1. Color conversion is factored out into the `ColorConversion` class, including independent unit tests. 2. K-means is factored out into the `KMeans3` class, including independent unit tests. I've also included a large testing dataset that I've created with a third-party tool to verify that the algorithm works. 3. The cluster-parameter selection heuristic is completely removed. Instead, we now always use four color clusters. 4. I've added a variety of sample images to test the algorithm, and it seems to do a good job on those images. These changes make the actual dominant color algorithm quite simple, and easier to reason about in isolation. Note that we don't specify how the algorithm works, and we make no guarantees that it'll always find the best background color. > Is there any way to allow the application to control that somehow? This is > complicated code that I think is not necessary in 90% of common cases. Yes, just set your own solid background color. That always works, and is the best choice for developers who want absolute predictability. ------------- PR Comment: https://git.openjdk.org/jfx/pull/2068#issuecomment-4342019733
