You do not need to reference the huge Windows.Forms dll to facilitate Color . Simply put, you simply multiply each value by the same factor:
private Color AdjustBrightness(double brightnessFactor) { Color originalColour = Color.Red; Color adjustedColour = Color.FromArgb(originalColour.A, (int)(originalColour.R * brightnessFactor), (int)(originalColour.G * brightnessFactor), (int)(originalColour.B * brightnessFactor)); return adjustedColour; }
Of course, this can be improved in several ways (and should), but you get this idea. In fact, this will Exception if the value exceeds 255, but I'm sure you can take care of that. Now you just need to check what type of Brush you need to make it brighter:
if (brush is SolidColorBrush) return new SolidColorBrush(AdjustBrightness(((SolidColorBrush)brush).Color)); else if (brush is LinearGradientBrush || brush is RadialGradientBrush) { // Go through each `GradientStop` in the `Brush` and brighten its colour }
Sheridan
source share