-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Include Default Color Styles #7800
Description
Include Default Color Styles
With .NET MAUI we've included Colors and then attached these to all settable properties via styles. Ideally we can take these concepts and just include these colors/styles into .NET MAUI itself. This way all of the colors are set with intelligent defaults.
Advantages
- Colors are set and known at the xplat level. If a user is inspecting a property via the LVT or pulling the Color from the xplat element they will retrieve an actual value opposed to just "null"
- Using styles gives users a consistent known location to set the theme for the app. They can easily see via the styles file and the colors what is settable.
- Propagate the colors set to "AccentColor" down to the platform. All three platforms have a concept of "AccentColor" so we should allow users to set an "AccentColor" and then we set that at the platform. There are a lot of chrome parts of an app (winui/android) that we probably won't expose xplat APIs for. If we let users set an xplat "Accent" and then propagate that to each platform then users won't have to drop down to the platform in order to make the chrome of the app fit what they want.
- Provide the ability to set default color schemes to start from.
Current State
-
With .NET MAUI we removed the code that extracted defaults. This has made it so when users use VSM the value is unable to clear and users are unable to return back to a default.
-
Currently we are in an awkward state because WinUI is still restoring back to defaults via clear value. Though Clear Value isn't 100 percent correct and can be problematic.
-
We either need to push forward with this plan or put this plan on hold and go back to just restoring defaults at the platform level.
Other issues to explore
- Theme Dictionaries. WinUI uses Theme Dictionaries to pivot between colors should we do the same?
- Applying colors set inside
Colors.xamldown to the platform version of those properties. For example, should we propagateAccentColordown toaccenton Android/WinUI/iOS? This way the chrome of the platform app will all match the accent color set by the user even for properties that we don't expose at the xplat level.
Road Blocks
-
Currently the amount of properties and VSM's that you can set don't give users enough control over all the states/colors of controls. The included Styles file represents all possible colors/vsms that you can set and it obviously falls short.
Give Developers more properties
Previous efforts
I spiked some work here to build defaults into the xplat layer.