private static T GetRandomColor <T>(RgbRandomColorFilter filter) where T : IColor { Random random = new Random(DateTime.Now.Millisecond); RGB rgb = new RGB( (byte)random.Next(filter.minR, filter.maxR), (byte)random.Next(filter.minG, filter.maxG), (byte)random.Next(filter.minB, filter.maxB)); return(ConvertRgbToNecessaryColorType <T>(rgb)); }
public static T GetDarkRandomColor <T>() where T : IColor { const byte maxRangeValue = 80; RgbRandomColorFilter filter = new RgbRandomColorFilter(); filter.maxR = maxRangeValue; filter.maxG = maxRangeValue; filter.maxB = maxRangeValue; return(GetRandomColor <T>(filter)); }
public static T GetLightRandomColor <T>() where T : IColor { const byte minRangeValue = 170; RgbRandomColorFilter filter = new RgbRandomColorFilter(); filter.minR = minRangeValue; filter.minG = minRangeValue; filter.minB = minRangeValue; return(GetRandomColor <T>(filter)); }