Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Color: Add obsolete Xamarin.Forms properties #281

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

swharden
Copy link
Contributor

@swharden swharden commented Jan 15, 2022

Color Properties

Originally suggested by @davidbritch in #280

This PR adds common properties from Xamarin.Forms.Color (R, G, B, A, Hue, Saturation, Luminosity) to Maui.Graphics.Color to make migration easier.

These properties are marked obsolete with messages indicating their replacements.

Related: #31, #32, #54, #58

Color.FromHtml()

I also added FromHtml() marked obsolete, but depending on feedback I'd really like to remove the obsolete attribute. People with previous System.Drawing experience may reach for this method name recalling ColorTranslator.FromHtml(). If they accidentally find FromHex() this will be bad because it forwards the string to FromArgb whose format is AARRGGBB and not the HMTL format.

public static Color FromHex(string colorAsArgbHex) => FromArgb(colorAsArgbHex);

Related: #81

Add Xamarin.Forms.Color properties to Maui.Graphics.Color (all marked obsolete): R, G, B, A, Hue, Luminosity, and Saturation dotnet#280
Add System.Drawing.ColorTranslator.FromHtml() functionality to Color, marking it obsolete with a message indicating to use Parse() instead
jsuarezruiz
jsuarezruiz previously approved these changes Jun 21, 2022
Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the first part of your description is going to be implied by the fact that it's marked as obsolete in Visual Studio. But this seems good to me otherwise, thanks!

src/Microsoft.Maui.Graphics/Color.cs Outdated Show resolved Hide resolved
src/Microsoft.Maui.Graphics/Color.cs Outdated Show resolved Hide resolved
src/Microsoft.Maui.Graphics/Color.cs Outdated Show resolved Hide resolved
src/Microsoft.Maui.Graphics/Color.cs Outdated Show resolved Hide resolved
src/Microsoft.Maui.Graphics/Color.cs Outdated Show resolved Hide resolved
src/Microsoft.Maui.Graphics/Color.cs Outdated Show resolved Hide resolved
src/Microsoft.Maui.Graphics/Color.cs Outdated Show resolved Hide resolved
@swharden swharden requested a review from jfversluis June 29, 2022 23:49
@swharden
Copy link
Contributor Author

I think the first part of your description is going to be implied by the fact that it's marked as obsolete in Visual Studio.

Hi @jfversluis, thanks for your input! I simplified the obsolete messages and agree with you that they read better now.

But this seems good to me otherwise, thanks!

Sure thing! Thanks to you and everyone else who keeps this project moving forward 🚀

Copy link
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, thank you so much for spending your valuable time in making this a better product!

LGTM!

@jsuarezruiz jsuarezruiz self-assigned this Jun 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants