public static HexColor GenerateRandomColor() { HexColor result = new HexColor(); Random ran = new Random(DateTime.Now.Second); result.Red = ran.Next(0, 255); result.Green = ran.Next(0, 255); result.Blue = ran.Next(0, 255); return(result); }
public HexColor AdjustBrightness(HexColor color, double factorRed, double factorGreen, double factorBlue) { double r = ((color.Red * factorRed) > 255) ? 255 : (color.Red * factorRed); double g = ((color.Green * factorGreen) > 255) ? 255 : (color.Green * factorGreen); double b = ((color.Blue * factorBlue) > 255) ? 255 : (color.Blue * factorBlue); HexColor result = new HexColor(); result.Red = (int)r; result.Green = (int)g; result.Blue = (int)b; return(result); }