This time, I want to share with you this great feature. Let me tell you something, when I saw this functionality I really LOVED IT ? !!! Because I can play with the colors! ?
In this post, we will be learning about the different functionalities that Xamarin Essentials bring to in the System.Drawing.Color libra
? Using color formats
? Transforming color aspects
First of all… What do I need?
- Add from NuGet Package the plugin: Xamarin.Essentials
You can read more information about Xamarin Essential here.
Using color formats
Xamarin Essential created the ColorConverts class for us. With this class we can convert the colors to different types. We can use the following:
▪ FromHex ➡ Receives a string as a Hexadecimal value.
▪ FromHls ➡ Receives three float values as parameters: Hue, Saturation and Luminosity.
▪ FromHsla ➡ Receives three float values as parameters: Hue, Saturation and Luminosity. And one parameters as an Int value: Alpha.
Transforming color aspects
This is my favorite topic ?. System.Drawing.Color
? WithAlpha ? WithLuminosity
? WithHue ? WithSaturation
To use it, you just must call the color extension type you just add the color next to the extension wished.Let’s see an example in code
Let’s see a simple example
In the following example, I used the same color with difference changes of color extensions but with the same value as parameter ( 30 ), with this way we can appreciate the difference.
Thanks for reading! ?