CSS roadmap proposal

Thiago Milczarek Sayão thiago.sayao at gmail.com
Thu May 29 21:29:56 UTC 2025


>
> - Allow global CSS. I might be missing something, but I think there's no
> easy way to tell JavaFx
> to use a CSS for the entire application.


There is Application.setUserAgentStylesheet, but I meant adding CSS files
on top of modena, not replacing it.


Em qui., 29 de mai. de 2025 às 16:23, Thiago Milczarek Sayão <
thiago.sayao at gmail.com> escreveu:

> Hi,
>
> - Allow global CSS. I might be missing something, but I think there's no
> easy way to tell JavaFx
> to use a CSS for the entire application.
>
> - Font Family Fallback: Add support for font family fallbacks in
> -fx-font-family, similar to standard CSS.
>  For example: -fx-font-family: "Inter", "Noto Sans", sans-serif;
>
> - Media Queries for device/screen size: Introduce support for media
> queries to adapt styles based on screen size,
> resolution, or other device characteristics. This will help usage of
> JavaFx outside of "desktop applications" scope,
> especially on devices where the application takes the entire screen.
>
> - Image Scaling: Provide a declarative way to scale images relative to
> their container size (e.g., percentage-based width/height).
>
> I’d be cautious about introducing an entirely new theme, as it could
> significantly increase the long-term maintenance effort.
> I would instead, improve modena by allowing it to be more customizable.
>
> -- Thiago.
>
>
>
> Em qui., 29 de mai. de 2025 às 15:32, Michael Strauß <
> michaelstrau2 at gmail.com> escreveu:
>
>> Here is how I think we should be evolving JavaFX CSS over the next
>> period of time:
>>
>> 1. Media queries
>> Gist: https://gist.github.com/mstr2/cbb93bff03e073ec0c32aac317b22de7
>> PR: https://github.com/openjdk/jfx/pull/1655
>>
>> This feature is already out for review.
>>
>> 2. System colors
>> Gist: https://gist.github.com/mstr2/afac42ab9587c1040a6cf7b091cee99f
>>
>> System colors allow stylesheet authors to use colors that are defined
>> by the scene or the platform. Most notably, this includes the accent
>> color. We will also add new media queries to help stylesheet authors
>> deal with contrast modes.
>>
>> 3. With media queries and system colors in place, we can remove the
>> built-in high contrast stylesheets that come with Caspian and Modena.
>> Instead of hard-coding these special cases (and not even in a good
>> way), we can now use standard APIs to achieve a better result. This
>> will remove a big chunk of special-casing from the codebase and bring
>> us closer to an equal playing field of built-in vs. third-party
>> themes.
>>
>> 4. Dark Modena / Modena 2025?
>>
>> 5. Bold new theme?
>>
>>
>> What do you think? Please focus comments on step 1-3, and not on
>> bikeshedding a new theme.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250529/55c10736/attachment.htm>


More information about the openjfx-dev mailing list