Tools for graphs were added
This commit is contained in:
@@ -7,12 +7,22 @@ namespace StructureHelperCommon.Services.ColorServices
|
||||
{
|
||||
public static class ColorProcessor
|
||||
{
|
||||
private static readonly Random random = new Random();
|
||||
public static Color GetRandomColor()
|
||||
{
|
||||
var randomR = new Random(new Random((int)DateTime.Now.Ticks % 1000).Next(50)).Next(0, 255);
|
||||
var randomG = new Random(new Random((int)DateTime.Now.Ticks % 200).Next(100, 200)).Next(0, 255);
|
||||
var randomB = new Random(new Random((int)DateTime.Now.Ticks % 50).Next(500, 1000)).Next(0, 255);
|
||||
return Color.FromRgb((byte)randomR, (byte)randomG, (byte)randomB);
|
||||
int r = random.Next(0, 255);
|
||||
int g = random.Next(0, 255);
|
||||
int b = random.Next(0, 255);
|
||||
|
||||
// check, that colors are different
|
||||
while (Math.Abs(r - g) < 30 || Math.Abs(g - b) < 30 || Math.Abs(b - r) < 30)
|
||||
{
|
||||
r = random.Next(0, 255);
|
||||
g = random.Next(0, 255);
|
||||
b = random.Next(0, 255);
|
||||
}
|
||||
|
||||
return Color.FromRgb((byte)r, (byte)g, (byte)b);
|
||||
}
|
||||
public static void EditColor(ref Color wpfColor)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user