Tools for graphs were added

This commit is contained in:
Evgeny Redikultsev
2023-05-06 21:10:02 +05:00
parent 3cb6e60fc9
commit 79c24f2cd5
31 changed files with 553 additions and 77 deletions

View File

@@ -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)
{