Hi Michael,

Thanks again for taking the time to answer my questions/comments and for
your efforts in coming forward with this new API proposal. And also thanks
for your patience as I can be a bit annoying at times. :)
There's of course a bunch of things I liked about your API proposal but for
the sake of time I specifically only commented on what I thought could
change and not on what I liked (I don't have much free spare time at the
moment, unfortunately). There's of course your idea itself of adding a
Theme API which I agree with.

Answering your comments below:

Theme stylesheets have a higher precedence than the application's
> user-agent stylesheet, but a lower precedence than author stylesheets.
> This is stated in the JavaFX CSS reference (cssref.html):


    * The JavaFX CSS implementation applies the following
>     * order of precedence: a style from a user agent style sheet or a
> style theme has lower
>     * priority than a value set from code, which has lower priority than a
> Scene
>     * or Parent style sheet.


We could include similar language in the javadoc.


I think we could add that it has higher precedence than a user agent
stylesheets but that's it's not an author stylesheet. We can also possibly
briefly say what a user agent stylesheet and author stylesheet are or
perhaps better yet, point to the css reference doc section that states it?

I deliberately wanted to minimize changes to the CSS subsystem in
> order to prevent introducing regressions in that area of the codebase.
> As a result, the proposed implementation treats theme stylesheets as a
> list of user-agent stylesheets, and optionally adds the application's
> user-agent stylesheet as the first item in that list. Note that
> `javafx.css.StyleOrigin` is also unchanged; you won't know whether a
> `StyleOrigin.USER_AGENT` stylesheet is the application's user-agent
> stylesheet, or one of its theme stylesheets.


Yes, I think minimizing changes to the CSS subsystem is a good idea.
I didn't mean we should make changes to the CSS subsystem, I meant/proposed
to add a flag or property in StyleThemes (the new API) that programmers
would then set in their StyleThemes and would define whether the StyleTheme
he's creating is a user agent stylesheet or an author stylesheet.

There's a role for third-party libraries here, and I think APIs for
> dark/light mode and other things can be done there.
> Supporting dark/light window frames is quite independent from the
> proposed style theme API, and should be done in a separate PR.
> I understand that it might be nice to have a comprehensive dark/light
> mode API in JavaFX, but there's a value in not going there and leaving
> that to libraries instead. I'd rather keep this feature as simple as
> it gets without sacrificing its unique capabilities. We can always
> come back and add more API surface if it turns out that we're really
> missing something.


I disagree here. I think this would be too low level for third party apps
to add support for, and as of today there isn't still yet any third party
library that adds it (which can itself be an indication that it's not a
good fit for third party libraries).
You'd need third party libraries to call on native code to change the frame
decoration of Windows that JavaFX spawns itself.
This API will already add some nice support to query platform preferences
(dark mode, accent color, etc) so I think it makes perfect sense to also
add API here to set the programmers preferences about these properties,
that JavaFX should then abide by.

Yes we could come back later to add that API.
As a theme developer and focusing on theme development only, this has been
on top of my wish list for a while. :)
Given that light/dark theme, etc feature is pervasive across all Oses I
think it's a shame that JavaFX doesn't yet fully support the development of
light/dark themes (especially dark themes).

4 - After reading Andy's comments I thought about a 4th point.
I agree with him in the part that we could have some of the platform
preference properties as Java properties. At least the things that are
pervasive across platforms, like whether the platform is set to dark or
light mode and the accent color.
I mean this in addition to the API that queries for platform properties
(i.e. I don't mean to remove the API you proposed to query for platform
properties).

Thanks again!



-- 
Pedro Duque Vieira - https://www.pixelduke.com

Reply via email to