-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to ThemeDictionaries #283
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…that should be hiding it anyway
- Missing DynamicResource in Calendar - Background defined twice in ButtonSpinnerStyles
Minor Fixes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is part of preview5, but because this has breaking changes related to FluentAvaloniaTheme and how to use the themes for this library, I'm pulling it out for visibility.
ThemeDictionaries are now here, along with a built in mechanism to resolve some system settings (
IPlatformSettings
). Starting with preview5, the following changes are being made:NOTE
HighContrast theme is broken right now and requires a fix upstream.
RequestedTheme
property is now obsolete, and you should change the requested theme using theRequestedThemeVariant
property on Application (or anywhere else). The property has not been removed yet, but will before the final v2 release. Along the same lines, theRequestedThemeChanged
event is obsolete as well. I'm marking obsolete now for migration purposes. Preview5 has A LOT of changes, let's make some things easier.InvalidateThemingFromSystemThemeChanged()
is also being marked obsolete. With the new changes, there not really any need for this anymoreHIGH CONTRAST THEME
A
ThemeVariant
is stored in FluentAvaloniaTheme for the HighContrast theme:To use:
In xaml, if you're building a resource dictionary for a custom control
RESOLVING SYSTEM RESOURCES
PreferSystemTheme
andPreferUserAccentColor
still work. On startup what will happen now is FATheme will redirect the call toApplication.Current.RequestedThemeVariant
with Light, Dark, or HighContrast theme.For the most part, I'm now deferring to
IPlatformSettings
for the lookup of theme & accent colors. On windows, this will have no effect. On MacOS, theme lookup should now work (if it didn't before) as the Avalonia implementation falls into ObjC territory. On linux, I'm preserving the existing lookup added previous before attempting the lookup with IPlatformSettings which is very limited.IPlatformSettings
also means this theme & accent color will work on WASM & mobile now too (at least where it supported).REFRESHING SYSTEM VALUES
FATheme will subscribe to
IPlatformSettings.ColorValuesChanged
, so if the Avalonia implementation supports listening for changes in system theme or accent color, FATheme will automatically take care of switching for you. This does require PreferSystemTheme and/or PreferUserAccentColor to be true. If you want to manage this yourself, you should disable those properties.For more on the Avalonia APIs:
IPlatformSettings & related: AvaloniaUI/Avalonia#9913
ThemeDictionaries/ThemeVariants: AvaloniaUI/Avalonia#8166