using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ColGen { class Program { static void Main(string[] args) { Program z = new Program(); int choice,version; List traits = new List(); List options = new List { "1)Uniform", "2)RandomWalk", "3)RandomMix", "4)RandomMix", "5)RandomMix", "6)RandomMix", "7)RandomMix", "8)RandomMix", "9)RandomAdd", "10)RandomAdd", "11)RandomAdd", "12)Offset", "13)Hue", "14)Saturation", "15)Luminance", "16)SaturationLuminance", "17)GoldenRatioRainbow", "18)GoldenRatioGradient", "19)JitteredRainbow", "20)JitteredRainbow", "21)JitteredRainbow", "22)HueRange", "23)Harmony", "24)Harmony2" }; foreach (var option in options) { Console.WriteLine(option); } choice = int.Parse(Console.ReadLine()); Console.WriteLine("Version?(if any)"); version = int.Parse(Console.ReadLine()); for (int i = 0; i < 4; i++) { if (i % 2 == 0) { var rand1 = new Random(DateTime.Now.Millisecond); traits.Add(z.Type1(z.ToSingleColour(rand1,choice,version))); Thread.Sleep(100); var rand2 = new Random(DateTime.Now.Millisecond); traits.Add(z.Type2(z.ToSingleColour(rand2, choice, version))); Thread.Sleep(100); var rand3 = new Random(DateTime.Now.Millisecond); traits.Add(z.Type1(z.ToSingleColour(rand3, choice, version))); Thread.Sleep(100); var rand4 = new Random(DateTime.Now.Millisecond); traits.Add(z.Type2(z.ToSingleColour(rand4, choice, version))); } else { var rand1 = new Random(DateTime.Now.Millisecond); traits.Add(z.Type3(z.ToSingleColour(rand1, choice, version))); Thread.Sleep(100); var rand2 = new Random(DateTime.Now.Millisecond); traits.Add(z.Type4(z.ToSingleColour(rand2, choice, version))); Thread.Sleep(100); var rand3 = new Random(DateTime.Now.Millisecond); traits.Add(z.Type3(z.ToSingleColour(rand3, choice, version))); Thread.Sleep(100); var rand4 = new Random(DateTime.Now.Millisecond); traits.Add(z.Type4(z.ToSingleColour(rand4, choice, version))); } } if (File.Exists("html.txt")) File.Delete("html.txt"); File.AppendAllLines("html.txt", traits); Console.WriteLine("DONE"); Console.ReadLine(); } public string ToSingleColour(Random rand,int choice,int version) { string colour, temp; Color a = this.GetColour(rand,choice,version); temp = a.Name; colour = "#" + temp.Substring(2, 6); return colour; } public string RandColor(Random rand) { double offset = 1.0; double value = (rand.Next(0, 255) + rand.Next(0, 255) + rand.Next(0, 255)) / 3; double value2 = (rand.Next(0, 255) + rand.Next(0, 255) + rand.Next(0, 255)) / 3; double value3 = (rand.Next(0, 255) + rand.Next(0, 255) + rand.Next(0, 255)) / 3; double newValue = value + 2 * rand.Next() * offset - offset; double valueRatio = (newValue / value); var color = String.Format("#FA{0:X2}01", rand.Next(0, 255)/*, rand.Next(0, 255), rand.Next(0, 255)*/); return color; } public string Type1(string onlyColor) { //string onlyColor = this.RandColor(rand); string type1 = string.Format("
\n", onlyColor); type1 = string.Concat(type1, "\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t
TraitName
Sincere:\n"); type1 = string.Concat(type1, string.Format("\t\t\t\t(0-100)
\n", onlyColor)); type1 = string.Concat(type1, "\t\t\t\tTrue(100)
\n"); type1 = string.Concat(type1, "\t\t\t\tFalse(0)\n"); type1 = string.Concat(type1, "\t\t\t
Dissimulated:\n"); type1 = string.Concat(type1, string.Format("\t\t\t\t(0-100)
\n", onlyColor)); type1 = string.Concat(type1, "\t\t\t\tTrue(100)
\n"); type1 = string.Concat(type1, "\t\t\t\tFalse(0)\n"); type1 = string.Concat(type1, "\t\t\t
Opinion:\n"); type1 = string.Concat(type1, "\t\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t
\n"); type1 = string.Concat(type1, "
"); return type1; } public string Type2(string onlyColor) { //string onlyColor = this.RandColor(rand); string type1 = string.Format("
\n", onlyColor); type1 = string.Concat(type1, "\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t
TraitName
Sincere:\n"); type1 = string.Concat(type1, string.Format("\t\t\t\t(0-100)
\n", onlyColor)); type1 = string.Concat(type1, "\t\t\t\tTrue(100)
\n"); type1 = string.Concat(type1, "\t\t\t\tFalse(0)\n"); type1 = string.Concat(type1, "\t\t\t
Dissimulated:\n"); type1 = string.Concat(type1, string.Format("\t\t\t\t(0-100)
\n", onlyColor)); type1 = string.Concat(type1, "\t\t\t\tTrue(100)
\n"); type1 = string.Concat(type1, "\t\t\t\tFalse(0)\n"); type1 = string.Concat(type1, "\t\t\t
Opinion:\n"); type1 = string.Concat(type1, "\t\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t
\n"); type1 = string.Concat(type1, "
"); return type1; } public string Type3(string onlyColor) { //string onlyColor = this.RandColor(rand); string type1 = string.Format("
\n", onlyColor); type1 = string.Concat(type1, "\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t
TraitName
Sincere:\n"); type1 = string.Concat(type1, string.Format("\t\t\t\t(0-100)
\n", onlyColor)); type1 = string.Concat(type1, "\t\t\t\tTrue(100)
\n"); type1 = string.Concat(type1, "\t\t\t\tFalse(0)\n"); type1 = string.Concat(type1, "\t\t\t
Dissimulated:\n"); type1 = string.Concat(type1, string.Format("\t\t\t\t(0-100)
\n", onlyColor)); type1 = string.Concat(type1, "\t\t\t\tTrue(100)
\n"); type1 = string.Concat(type1, "\t\t\t\tFalse(0)\n"); type1 = string.Concat(type1, "\t\t\t
Opinion:\n"); type1 = string.Concat(type1, "\t\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t
\n"); type1 = string.Concat(type1, "
"); return type1; } public string Type4(string onlyColor) { //string onlyColor = this.RandColor(rand); string type1 = string.Format("
\n", onlyColor); type1 = string.Concat(type1, "\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t\n"); type1 = string.Concat(type1, "\t\t\n"); type1 = string.Concat(type1, "\t
TraitName
Sincere:\n"); type1 = string.Concat(type1, string.Format("\t\t\t\t(0-100)
\n", onlyColor)); type1 = string.Concat(type1, "\t\t\t\tTrue(100)
\n"); type1 = string.Concat(type1, "\t\t\t\tFalse(0)\n"); type1 = string.Concat(type1, "\t\t\t
Dissimulated:\n"); type1 = string.Concat(type1, string.Format("\t\t\t\t(0-100)
\n", onlyColor)); type1 = string.Concat(type1, "\t\t\t\tTrue(100)
\n"); type1 = string.Concat(type1, "\t\t\t\tFalse(0)\n"); type1 = string.Concat(type1, "\t\t\t
Opinion:\n"); type1 = string.Concat(type1, "\t\t\t\t\n"); type1 = string.Concat(type1, "\t\t\t
\n"); type1 = string.Concat(type1, "
"); return type1; } public Color GetColour(Random random, int outerSel = 1, int version = 0) { //random = new Random(15);//15 //Random random = new Random(12);//15 Color color = new Color(); //int versionCount = 3; int colorCount = 1; //int imageWidth = 680; //int imageHeight = 100; //int spacing = 2; Color[] baseColors = { Color.FromArgb(255, 128, 0), Color.FromArgb(128, 255, 64), Color.FromArgb(64, 128, 255)}; float[] saturation = { 1.0f, 0.7f, 0.3f }; float[] luminance = { 0.45f, 0.7f, 0.4f }; float[] hueStart = { 0.9f, 0.2f, 0.6f }; float[] hueEnd = { 0.1f, 0.5f, 0.9f }; Color[] mixColor1 = { Color.FromArgb(255, 0, 33), Color.FromArgb(255, 100, 33), Color.FromArgb(128, 0, 33), }; Color[] mixColor2 = { Color.FromArgb(255, 255, 0), Color.FromArgb(255, 255, 100), Color.FromArgb(255, 128, 0), }; Color[] mixColor3 = { Color.FromArgb(0, 100, 255), Color.FromArgb(100, 150, 255), Color.FromArgb(0, 80, 128), }; Color[] addColor1 = { Color.FromArgb(150, 0, 0), Color.FromArgb(200, 20, 0), Color.FromArgb(128, 0, 33), }; Color[] addColor2 = { Color.FromArgb(0, 150, 0), Color.FromArgb(200, 200, 20), Color.FromArgb(255, 128, 0), }; Color[] addColor3 = { Color.FromArgb(0, 0, 150), Color.FromArgb(20, 20, 200), Color.FromArgb(0, 80, 128), }; Color[][] gradients = { new Color[] { Color.FromArgb(255, 0, 128), Color.FromArgb(255, 255, 0), Color.FromArgb(0, 255, 255), }, new Color[] { Color.FromArgb(200, 0, 33), Color.FromArgb(255, 200, 0), Color.FromArgb(0, 100, 200), }, new Color[] { Color.FromArgb(255, 0, 33), Color.FromArgb(255, 255, 0), Color.FromArgb(0, 255, 0), Color.FromArgb(255, 255, 0), } }; float[] offsetAngles1 = { 15, 180, 120 }; float[] offsetAngles2 = { 30, 0, 240 }; float[] angleRanges1 = { 15, 40f, 40 }; float[] angleRanges2 = { 15, 40f, 40 }; float[] angleRanges3 = { 15, 0, 40 }; switch (outerSel) { case 1: { color = ProceduralPalette.ProceduralPalette.GenerateColors_Uniform(colorCount).First(); } break; case 2: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomWalk(colorCount, baseColors[version], 0.2f, 0.4f).First(); } break; case 3: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.1f, true).First(); } break; case 4: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.5f, true).First(); } break; case 5: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.9f, true).First(); } break; case 6: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.1f, false).First(); } break; case 7: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.5f, false).First(); } break; case 8: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.9f, false).First(); } break; case 9: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomAdd(colorCount, addColor1[version], addColor2[version], addColor3[version], 0.1f).First(); } break; case 10: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomAdd(colorCount, addColor1[version], addColor2[version], addColor3[version], 0.5f).First(); } break; case 11: { color = ProceduralPalette.ProceduralPalette.GenerateColors_RandomAdd(colorCount, addColor1[version], addColor2[version], addColor3[version], 0.9f).First(); } break; case 12: { color = ProceduralPalette.ProceduralPalette.GenerateColors_Offset(colorCount, baseColors[version], 0.4f).First(); } break; case 13: { color = ProceduralPalette.ProceduralPalette.GenerateColors_Hue(colorCount, saturation[version], luminance[version]).First(); } break; case 14: { color = ProceduralPalette.ProceduralPalette.GenerateColors_Saturation(colorCount, hueStart[version], luminance[version]).First(); } break; case 15: { color = ProceduralPalette.ProceduralPalette.GenerateColors_Luminance(colorCount, hueStart[version], saturation[version]).First(); } break; case 16: { color = ProceduralPalette.ProceduralPalette.GenerateColors_SaturationLuminance(colorCount, hueStart[version]).First(); } break; case 17: { color = ProceduralPalette.ProceduralPalette.GenerateColors_GoldenRatioRainbow(colorCount, saturation[version], luminance[version]).First(); } break; case 18: { color = ProceduralPalette.ProceduralPalette.GenerateColors_GoldenRatioGradient(colorCount, gradients[0], saturation[0], luminance[0]).First(); } break; case 19: { color = ProceduralPalette.ProceduralPalette.GenerateColors_JitteredRainbow(colorCount, 0, 1, saturation[version], luminance[version], true).First(); } break; case 20: { color = ProceduralPalette.ProceduralPalette.GenerateColors_JitteredRainbow(colorCount, hueStart[version], hueEnd[version], saturation[version], luminance[version], true).First(); } break; case 21: { color = ProceduralPalette.ProceduralPalette.GenerateColors_JitteredRainbow(colorCount, 0, 1, saturation[version], luminance[version], false).First(); } break; case 22: { color = ProceduralPalette.ProceduralPalette.GenerateColors_HueRange(colorCount, hueStart[version], hueEnd[version], saturation[version], luminance[version]).First(); } break; case 23: { color = ProceduralPalette.ProceduralPalette.GenerateColors_Harmony(colorCount, offsetAngles1[version], offsetAngles2[version], angleRanges1[version], angleRanges2[version], angleRanges3[version], saturation[version], luminance[version]).First(); } break; case 24: { color = ProceduralPalette.ProceduralPalette.GenerateColors_Harmony2(colorCount, offsetAngles1[version], offsetAngles2[version], angleRanges1[version], angleRanges2[version], angleRanges3[version], saturation[version], 0.2f, luminance[version], 0.5f).First(); } break; default: break; } return color; } } }