On Mon, 22 Jun 2026 18:29:47 GMT, Michael Strauß <[email protected]> wrote:

> Good question. I think that themes shouldn't excessively change styles based 
> on the platform, because that's a very broad category. On the web, you'll see 
> a trend of moving to finer-grained capabilities (for example, 
> `prefers-color-scheme` or `pointer: fine`) instead of using the platform as a 
> decision proxy. The reason that I'm proposing to add `-fx-platform` is not so 
> much that I think themes should be doing _more_ of these tests, especially 
> not new themes. This media query is a relatively crude helper that allows us 
> to define the old Caspian and Modena themes in CSS without hard-coded 
> optional stylesheets.

I agree with your point. However, I think it's worth noting that on the desktop 
side, there are legitimate use cases beyond refining Modena and Caspian for the 
platform media query.

The distinction here is that browsers already provide the native look and feel 
(header bar, window controls), and the website lives inside the browser. I'm 
not aware of a common use case where websites aim to look different on each OS 
(And unstyled HTML also usually does not match the native look and feel).
Desktop applications, on the other hand, are the top-level window - so matching 
the native look and feel is a much more common and valid goal.

And there are already community projects with such themes, one example is 
[JMetro](https://www.pixelduke.com/java-javafx-theme-jmetro/).

So I think the use case for platform queries is valid and will make it easy to 
change some CSS variables or things like the `HeaderBar` (+icons) rather than 
requiring programmatic stylesheet switching or other workarounds.

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

PR Comment: https://git.openjdk.org/jfx/pull/2193#issuecomment-4826493362

Reply via email to