Hi again Michael,

Thanks for taking the time to answer my comments.
As always, it's easier to comment on and criticize than to do the actual
work of implementing the feature. So thanks again for the patience.

My comments below:


I don't quite understand this. Can you elaborate on what the
> advantages would be, and how (and for what purpose) users of the API
> would use such a flag?


No problem, I mentioned those in my first comment but probably got lost in
this conversation.
2 – I think the ability to specify in the StyleTheme whether it is a user
agent stylesheet, or an author stylesheet could be of interest. Most of the
themes I know are composed of author stylesheets (they use the
getStylesheets() API in Scene) so migration to using the StyleTheme API
would be easier if one could specify this. Conversely specifying that the
StyleTheme is a user agent stylesheet will also be very useful in the cases
where we’re creating a theme but don’t want it to override styles specified
through code, etc.

I'll now also add that you might want to create a theme, from the get go,
that doesn't get trumped by any rule set through code, either code itself
on in FXML files (which will be code anyway). So that the theme css is what
always drives the presentation of your app (it has priority).
This is already possible by choosing to add your stylesheets to the Scene
getStylesheets() method or by using the setUserAgentStylesheet() method.


I don't think that we need any new API for dark mode window frames.
> On macOS, the color of the window frame is already adjusted to match
> the system-wide dark/light mode.
> On Windows, this is not the case:


https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes


    "Not all Win32 applications support Dark mode, so
>     Windows gives Win32 apps a light title bar by
>     default. If you are prepared to support Dark mode,
>     you can ask Windows to draw the dark title bar
>     instead when Dark mode is enabled."


Since JavaFX already uses dark frames on macOS, why not do the same on
> Windows?
> We can simply enable this behavior in general, and provide a system
> property to revert to the old behavior of always using light frames,
> even if dark mode is enabled.


Ok thanks for clarifying what happens on Mac. Yes on the Windows OS, JavaFX
won't honor your system wide settings. If your system is in dark mode the
frames will still be shown in light mode.
But anyways, I think, the programmer should be able to toggle the
dark/light mode setting irrespective of what is defined in the system.
There are many apps where you, as a user, can choose dark or light mode in
the app itself and it will honor it regardless of what you have defined in
the system (e.g. Intellij, Slack, etc, etc). Some will allow you to set
whether you want to use the system setting for light/dark mode or your own
setting in the app.
This can be of value in cases where you, as a user, prefer to use an app in
dark mode and others in some other mode, so you can choose themes on an app
by app basis.
Or perhaps the developer wants to design an app that's just dark. In that
case you'd want the ability to toggle the frame decorations to being dark
(all the time).


Here's a simple implementation that exposes dark mode and accent
> coloring as JavaFX properties on a theme base class:
> https://gist.github.com/mstr2/ba2f9cba659953788008fed1e9b2a031


We might consider adding something like this to JavaFX in the future,
> but for the time being, I'd rather let third-party libraries explore
> higher-level APIs first.


Just to be clear I was just talking about how we would present this API
(platform preferences). This property would be a way to more easily know if
the system is in dark/light mode, the accent color, without needing to know
the specific "key".

Thanks again!

On Mon, Jan 16, 2023 at 4:01 AM Michael Strauß <michaelstr...@gmail.com>
wrote:

> My comments below:
>
> On Sun, Jan 15, 2023 at 1:25 PM Pedro Duque Vieira
> <pedro.duquevie...@gmail.com> wrote:
> >
> > 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?
>
> Sure, I'll add some additional documentation.
>
>
>
> > 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.
>
> I don't quite understand this. Can you elaborate on what the
> advantages would be, and how (and for what purpose) users of the API
> would use such a flag?
>
>
>
> > 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).
>
> I don't think that we need any new API for dark mode window frames.
> On macOS, the color of the window frame is already adjusted to match
> the system-wide dark/light mode.
> On Windows, this is not the case:
>
>
> https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes
>
>     "Not all Win32 applications support Dark mode, so
>     Windows gives Win32 apps a light title bar by
>     default. If you are prepared to support Dark mode,
>     you can ask Windows to draw the dark title bar
>     instead when Dark mode is enabled."
>
> Since JavaFX already uses dark frames on macOS, why not do the same on
> Windows?
> We can simply enable this behavior in general, and provide a system
> property to revert to the old behavior of always using light frames,
> even if dark mode is enabled.
>
>
>
> > 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).
>
> Here's a simple implementation that exposes dark mode and accent
> coloring as JavaFX properties on a theme base class:
> https://gist.github.com/mstr2/ba2f9cba659953788008fed1e9b2a031
>
> We might consider adding something like this to JavaFX in the future,
> but for the time being, I'd rather let third-party libraries explore
> higher-level APIs first.
>


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

Reply via email to