I have a colour picker that allows my Xamarin app to set a theme colour. I want to calculate a darker shade of the same colour to identify different items.
How can I calculate a darker shade from a colour?
Assuming this is a Forms' Color, you can use the WithLuminosity
method to decrease its "brightness" value and return a new darker color.
Example:
var color = label.BackgroundColor;
var newColor = color.WithLuminosity(color.Luminosity - (color.Luminosity * .1));
label.BackgroundColor = newColor;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With