Allow checking at runtime about the current theme (#8049)

Although std-widgets provides many properties that adapt to the current theme users who would like to go beyond these properties and do theme dependent changes are limited. One option would be to add even more properties to the Palette, however this would potentially bloat the object, it's not obvious what properties users care about and this approach doesn't scale. In many cases developers could simply create their own properties if they knew what the current runtime theme was.

This simple change allows an app to know what the current theme is and present theme appropriate UI's.
This commit is contained in:
Nigel Breslaw 2025-04-04 14:44:14 +03:00 committed by GitHub
parent d185333165
commit 538f8bde19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 36 additions and 0 deletions

View file

@ -22,6 +22,7 @@ export global StyleMetrics {
}
export global Palette {
out property <string> style-name: "fluent";
out property <brush> background: FluentPalette.background;
out property <brush> foreground: FluentPalette.foreground;
out property <brush> alternate-background: FluentPalette.alternate-background;