How do I add a color effect to a UI element? (WPF)
For example, it should look more yellow, so pixels have a more yellow color. All I need is to make my black form a bit white, while it is inactive.
I recently needed a gradient effect that would go from a specified color to a lighter version of that color. I came across this post which works very nicely.
Here is the code as an extension method
public static Color Interpolate(this Color color1, Color color2, float percentage)
double a1 = color1.A / 255.0, r1 = color1.R / 255.0, g1 = color1.G / 255.0, b1 = color1.B / 255.0;
double a2 = color2.A / 255.0, r2 = color2.R / 255.0, g2 = color2.G / 255.0, b2 = color2.B / 255.0;
byte a3 = Convert.ToByte((a1 + (a2 - a1) * percentage) * 255);
byte r3 = Convert.ToByte((r1 + (r2 - r1) * percentage) * 255);
byte g3 = Convert.ToByte((g1 + (g2 - g1) * percentage) * 255);
byte b3 = Convert.ToByte((b1 + (b2 - b1) * percentage) * 255);
return Color.FromArgb(a3, r3, g3, b3);
In my case I mix in 50 % white