<div dir="ltr">Hi again Michael,<div><br></div><div>Thanks for taking the time to answer my comments.</div><div>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.</div><div><br>My comments below:<span class="gmail-im" style="color:rgb(80,0,80)"><br><br></span><span class="gmail-im" style="color:rgb(80,0,80)"><br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I don't quite understand this. Can you elaborate on what the<br>advantages would be, and how (and for what purpose) users of the API<br>would use such a flag?</blockquote><span class="gmail-im" style="color:rgb(80,0,80)"><br></span><div><span class="gmail-im" style="">No problem, I mentioned those in my first comment but probably got lost in this conversation. <br>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.</span></div><div><span class="gmail-im" style=""><br></span></div><div><span class="gmail-im" style="">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).</span></div><div><span class="gmail-im" style="">This is already possible by choosing to add your stylesheets to the Scene getStylesheets() method or by using the </span>setUserAgentStylesheet() method.</div><div><br></div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I don't think that we need any new API for dark mode window frames.<br>On macOS, the color of the window frame is already adjusted to match<br>the system-wide dark/light mode.<br>On Windows, this is not the case:</blockquote><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes" rel="noreferrer" target="_blank">https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes</a></blockquote><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">    "Not all Win32 applications support Dark mode, so<br>    Windows gives Win32 apps a light title bar by<br>    default. If you are prepared to support Dark mode,<br>    you can ask Windows to draw the dark title bar<br>    instead when Dark mode is enabled."</blockquote><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Since JavaFX already uses dark frames on macOS, why not do the same on Windows?<br>We can simply enable this behavior in general, and provide a system<br>property to revert to the old behavior of always using light frames,<br>even if dark mode is enabled.</blockquote><div> </div><div>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. </div>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.</div><div>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.<br>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).</div><div><span class="gmail-im" style="color:rgb(80,0,80)"><br><br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Here's a simple implementation that exposes dark mode and accent<br>coloring as JavaFX properties on a theme base class:<br><a href="https://gist.github.com/mstr2/ba2f9cba659953788008fed1e9b2a031" rel="noreferrer" target="_blank">https://gist.github.com/mstr2/ba2f9cba659953788008fed1e9b2a031</a></blockquote><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We might consider adding something like this to JavaFX in the future,<br>but for the time being, I'd rather let third-party libraries explore<br>higher-level APIs first.</blockquote><div><br></div><div>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".</div></div></div><div><br></div><div>Thanks again!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 16, 2023 at 4:01 AM Michael Strauß <<a href="mailto:michaelstrau2@gmail.com">michaelstrau2@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">My comments below:<br>
<br>
On Sun, Jan 15, 2023 at 1:25 PM Pedro Duque Vieira<br>
<<a href="mailto:pedro.duquevieira@gmail.com" target="_blank">pedro.duquevieira@gmail.com</a>> wrote:<br>
><br>
> 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?<br>
<br>
Sure, I'll add some additional documentation.<br>
<br>
<br>
<br>
> Yes, I think minimizing changes to the CSS subsystem is a good idea.<br>
> 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.<br>
<br>
I don't quite understand this. Can you elaborate on what the<br>
advantages would be, and how (and for what purpose) users of the API<br>
would use such a flag?<br>
<br>
<br>
<br>
> 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).<br>
> You'd need third party libraries to call on native code to change the frame decoration of Windows that JavaFX spawns itself.<br>
> 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.<br>
><br>
> Yes we could come back later to add that API.<br>
> As a theme developer and focusing on theme development only, this has been on top of my wish list for a while. :)<br>
> 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).<br>
<br>
I don't think that we need any new API for dark mode window frames.<br>
On macOS, the color of the window frame is already adjusted to match<br>
the system-wide dark/light mode.<br>
On Windows, this is not the case:<br>
<br>
<a href="https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes" rel="noreferrer" target="_blank">https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes</a><br>
<br>
    "Not all Win32 applications support Dark mode, so<br>
    Windows gives Win32 apps a light title bar by<br>
    default. If you are prepared to support Dark mode,<br>
    you can ask Windows to draw the dark title bar<br>
    instead when Dark mode is enabled."<br>
<br>
Since JavaFX already uses dark frames on macOS, why not do the same on Windows?<br>
We can simply enable this behavior in general, and provide a system<br>
property to revert to the old behavior of always using light frames,<br>
even if dark mode is enabled.<br>
<br>
<br>
<br>
> 4 - After reading Andy's comments I thought about a 4th point.<br>
> 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.<br>
> 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).<br>
<br>
Here's a simple implementation that exposes dark mode and accent<br>
coloring as JavaFX properties on a theme base class:<br>
<a href="https://gist.github.com/mstr2/ba2f9cba659953788008fed1e9b2a031" rel="noreferrer" target="_blank">https://gist.github.com/mstr2/ba2f9cba659953788008fed1e9b2a031</a><br>
<br>
We might consider adding something like this to JavaFX in the future,<br>
but for the time being, I'd rather let third-party libraries explore<br>
higher-level APIs first.<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Pedro Duque Vieira - <a href="https://www.pixelduke.com" target="_blank">https://www.pixelduke.com</a></div></div></div>