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.

Reply via email to