-
Notifications
You must be signed in to change notification settings - Fork 63
Color is missing Default
and Accent
#57
Comments
Duplicate of #48 |
To answer Jon's question from the parent issue - in Forms, Color.Default really just means "let the native platform decide". So the color should be whatever it would be absent any cross-platform code, taking into account any native themes. And if the native theme changes, the color should change accordingly. This includes things like "light/dark" theme changes or system accent colors changing. (There are certainly some bugs in Forms's implementations of this, but that's the general idea.) So it's really just a way for the cross-platform code to say "from a cross-platform perspective, we don't care what color this thing is". The same thing could probably be done by simply making the cross-platform colors nullable (either via
Yes, it will technically be a breaking change to remove it. It will also be correct. |
No change planned. |
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
Save previous assigned color and use instead of Color.Default. This is needed because maui doesn't have Color.Default [1]. And this commit is workaround for that. [1] dotnet/Microsoft.Maui.Graphics#57
These two "colors" were nice to have so that there was a way to tell the renderers that either the default platform color or the platform accent color should be used.
Using this dummy color allows the actual to be determined at runtime on a particular OS. This is also good at hiding a concept from shared code that cannot be pre-determined. For example accent colors could change between OS and user prefs.
Having a real color would require some events to be raised and then when setting colors they will need to be requested by the user or somehow tracked.
Switching to a
class
(#56) or using nullable, does sort of help with this, but also moves the issue. Assuming "null color" means "default color", we still have to resolve "accent color". But now we also need to determine what is a "no color" vs "default color"These is some discussion in the Discord on this: https://discord.com/channels/732297728826277939/732297916680765551/830071063555080254
There is also a separate style manager/watcher/theme handling needed. Not sure what is best at this point:
The Xamarin.Forms Color had a special enum field to flag a color as a default color or as a RGB/HSL color. WinForms has a state field. And this is also used by WPF in a weird way with a struct with sub-color structs... Not sure if this is the right way, but it is a way.
This can be a thing (not sure it is a good thing, but still a thing):
Relates to parent issue: #58
The text was updated successfully, but these errors were encountered: