Skip to content

Include Default Color Styles #7800

@PureWeen

Description

@PureWeen

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

#6183 (comment)

  • 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.xaml down to the platform version of those properties. For example, should we propagate AccentColor down to accent on 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

Previous efforts

I spiked some work here to build defaults into the xplat layer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions