Skip to content
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

[Enhancement] Provide Migration guidance for Xamarin.Forms.Color #1668

Open
david-maw opened this issue Jul 14, 2021 · 7 comments
Open

[Enhancement] Provide Migration guidance for Xamarin.Forms.Color #1668

david-maw opened this issue Jul 14, 2021 · 7 comments
Labels
area-docs Conceptual docs, API docs, Samples migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert t/enhancement ☀️ New feature or request
Milestone

Comments

@david-maw
Copy link

Summary

The Xamarin.Forms.Color struct seems to have been replaced by a combination of the Microsoft.Maui.Graphics.Color class and the Microsoft.Maui.Graphics.Colors class. Obviously these are quite different so some guidance is probably called for to deal with migration.

API Changes

If I had my druthers I think I lean toward the Xamarin.Forms approach of color as a struct rather than the MAUI approach of making it a pair of classes, mostly because I'm not sure reference semantics are appropriate and a color description doesn't take up much memory, but assuming there's a good reason to use classes instead of structs the main issues I see for people migrating code are:

  • The semantic differences between objects and classes (assignments, equality, reference counting, null references etc.)
  • Code using color literals like Color.Red would need to change to use Colors.Red (note the 's')
  • Some existing values like Color.Accent and Color.Default do not have obvious alternatives (this also shows up in XAML, where, say, Color="Accent" is used in Xamarin Forms).
  • The general move to float rather than double storage might cause some surprises but not implementing the R, G, B and A properties should at least make for compile time failures rather than run time.

If there's a blog post or something explaining why the model change to Color and Colors classes are desirable (certainly a switch to float from double to store RGBA values seems like it might perhaps save a bit of space) I'd appreciate it if someone could point me to it.

Intended Use Case

The proposed guidance would likely be needed whenever a code base with nontrivial uses of Xamarin.Forms.Color was being migrated.

@mcguu

This comment was marked as off-topic.

@david-maw

This comment was marked as off-topic.

@mcguu

This comment was marked as off-topic.

@JohnHDev
Copy link

I would be interested to know why this was changed? There are many things wrong with Xamarin.Forms, but Color wasn't one of them.

@jsuarezruiz
Copy link
Contributor

@davidbritch Have sense to include something like this in the documentation?

@jsuarezruiz jsuarezruiz added the s/needs-info Issue needs more info from the author label Nov 5, 2021
@hartez hartez added area-docs Conceptual docs, API docs, Samples area/migration 🚚 labels Nov 5, 2021
@Redth Redth removed the s/needs-info Issue needs more info from the author label Feb 15, 2022
@jfversluis
Copy link
Member

@davidortinau is this something we can provide? Or maybe already have something on somewhere?

@rachelkang rachelkang added this to the Backlog milestone Nov 2, 2022
@ghost
Copy link

ghost commented Nov 2, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@samhouts samhouts added the t/enhancement ☀️ New feature or request label Jul 31, 2023
@samhouts samhouts added migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert and removed area/migration 🚚 labels Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-docs Conceptual docs, API docs, Samples migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert t/enhancement ☀️ New feature or request
Projects
No open projects
Status: Todo
Development

No branches or pull requests

9 participants