From 1029ea6fc7dd7e42b16d3eece965a2d10587a06e Mon Sep 17 00:00:00 2001 From: thepra Date: Thu, 2 Mar 2017 13:36:26 +0100 Subject: [PATCH] First commit --- ColGen.sln | 20 + ColGen/App.config | 6 + ColGen/ColGen.csproj | 65 +++ ColGen/HSL.cs | 296 ++++++++++++ ColGen/Program.cs | 430 +++++++++++++++++ ColGen/Properties/AssemblyInfo.cs | 36 ++ ColGen/func.cs | 757 ++++++++++++++++++++++++++++++ 7 files changed, 1610 insertions(+) create mode 100644 ColGen.sln create mode 100644 ColGen/App.config create mode 100644 ColGen/ColGen.csproj create mode 100644 ColGen/HSL.cs create mode 100644 ColGen/Program.cs create mode 100644 ColGen/Properties/AssemblyInfo.cs create mode 100644 ColGen/func.cs diff --git a/ColGen.sln b/ColGen.sln new file mode 100644 index 0000000..2a9e08d --- /dev/null +++ b/ColGen.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColGen", "ColGen\ColGen.csproj", "{B5240A73-56EE-44C1-88BE-BDD99DA3AC71}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B5240A73-56EE-44C1-88BE-BDD99DA3AC71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B5240A73-56EE-44C1-88BE-BDD99DA3AC71}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B5240A73-56EE-44C1-88BE-BDD99DA3AC71}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B5240A73-56EE-44C1-88BE-BDD99DA3AC71}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ColGen/App.config b/ColGen/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/ColGen/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ColGen/ColGen.csproj b/ColGen/ColGen.csproj new file mode 100644 index 0000000..17554fe --- /dev/null +++ b/ColGen/ColGen.csproj @@ -0,0 +1,65 @@ + + + + + Debug + AnyCPU + {B5240A73-56EE-44C1-88BE-BDD99DA3AC71} + Exe + Properties + ColGen + ColGen + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + + + + + + + \ No newline at end of file diff --git a/ColGen/HSL.cs b/ColGen/HSL.cs new file mode 100644 index 0000000..8dfa1e5 --- /dev/null +++ b/ColGen/HSL.cs @@ -0,0 +1,296 @@ +//---------------------------------------------------------------------- +// Namespace Christo.GFX.Conversion +// Author: Christo Greeff +// Date: 24/June/2008 +//---------------------------------------------------------------------- +// 24/June/2008 : New: GFXConversionException, HSL +//---------------------------------------------------------------------- + +using System; +using System.Drawing; + +namespace Christo.GFX.Conversion +{ + /// + /// Color Util Exception + /// + public class GFXConversionException : Exception + { + public GFXConversionException(string message, Exception innerException) + : base(message, innerException) + { + //ToDo: Implement if needed + } + } + + /// + /// HSL (Hue/Saturation/Luminance) Class + /// + public class HSL + { + #region Private members + + /// + /// private hue + /// + private double _h; + + /// + /// private saturation + /// + private double _s; + + /// + /// private luminance + /// + private double _l; + + #endregion + + /// + /// Constructor + /// + public HSL() + { + try + { + this.HSLHelper(0, 0, 0); + } + catch (Exception ee) + { + throw new GFXConversionException("HSL Constructor Error", ee); + } + } + + /// + /// Constructor with ARGB color + /// + /// System.Drawing.Color value + public HSL(Color color) + { + try + { + this.HSLHelper(color.GetHue() / 360.0, color.GetSaturation(), color.GetBrightness()); + } + catch (Exception ee) + { + throw new GFXConversionException("HSL Constructor Error", ee); + } + } + + /// + /// Constructor with RGB color + /// + /// Red component with a value from 0 to 255 + /// Green component with a value from 0 to 255 + /// Blue component with a value from 0 to 255 + public HSL(byte R, byte G, byte B) + { + try + { + Color temp = Color.FromArgb(R, G, B); + this.HSLHelper(temp.GetHue() / 360.0, temp.GetSaturation(), temp.GetBrightness()); + } + catch (Exception ee) + { + throw new GFXConversionException("HSL Constructor Error", ee); + } + } + + /// + /// Constructor with HSL + /// + /// Varies from magenta - red - yellow - green - cyan - blue - magenta, described as an angle around a circle from 0.0 - 360.0 degrees + /// Varies from 0.0 and 1.0 and describes how "grey" the colour is, with 0 being completely unsaturated (grey, white or black) and 1 being completely saturated + /// Varies from 0.0 and 1.0 and ranges from black at 0.0, through the standard colour itself at 0.5 to white at 1.0 + public HSL(double Hue, double Saturation, double Luminance) + { + try + { + this.HSLHelper(Hue, Saturation, Luminance); + } + catch (Exception ee) + { + throw new GFXConversionException("HSL Constructor Error", ee); + } + } + + /// + /// HSL Helper + /// + /// Varies from magenta - red - yellow - green - cyan - blue - magenta, described as an angle around a circle from 0.0 - 360.0 degrees + /// Varies from 0.0 and 1.0 and describes how "grey" the colour is, with 0 being completely unsaturated (grey, white or black) and 1 being completely saturated + /// Varies from 0.0 and 1.0 and ranges from black at 0.0, through the standard colour itself at 0.5 to white at 1.0 + private void HSLHelper(double Hue, double Saturation, double Luminance) + { + try + { + this.H = Hue; + this.S = Saturation; + this.L = Luminance; + } + catch (Exception ee) + { + throw new GFXConversionException("HSL HSLHelper Error", ee); + } + } + + /// + /// Set helper function + /// + /// value that must be between 0 and 1 + /// double value + private double SetHelper(double value) + { + try + { + return (value > 1) ? 1.0 : (value < 0) ? 0 : value; + } + catch (Exception ee) + { + throw new GFXConversionException("HSL SetHelper Error", ee); + } + } + + /// + /// Gets or sets the Hue value + /// + public double H + { + get + { + return this._h; + } + set + { + this._h = this.SetHelper(value); + } + } + + /// + /// Gets or sets the Saturation value + /// + public double S + { + get + { + return this._s; + } + set + { + this._s = this.SetHelper(value); + } + } + + /// + /// Gets or sets the Luminance value + /// + public double L + { + get + { + return this._l; + } + set + { + this._l = this.SetHelper(value); + } + } + + /// + /// Convert from the current HSL to RGB + /// http://en.wikipedia.org/wiki/HSV_color_space#Conversion_from_HSL_to_RGB + /// + public Color Color + { + get + { + double[] t = new double[] { 0, 0, 0 }; + + try + { + double tH = this._h; + double tS = this._s; + double tL = this._l; + + if (tS.Equals(0)) + { + t[0] = t[1] = t[2] = tL; + } + else + { + double q, p; + + q = tL < 0.5 ? tL * (1 + tS) : tL + tS - (tL * tS); + p = 2 * tL - q; + + t[0] = tH + (1.0 / 3.0); + t[1] = tH; + t[2] = tH - (1.0 / 3.0); + + for (byte i = 0; i < 3; i++) + { + t[i] = t[i] < 0 ? t[i] + 1.0 : t[i] > 1 ? t[i] - 1.0 : t[i]; + + if (t[i] * 6.0 < 1.0) + t[i] = p + ((q - p) * 6 * t[i]); + else + if (t[i] * 2.0 < 1.0) + t[i] = q; + else + if (t[i] * 3.0 < 2.0) + t[i] = p + ((q - p) * 6 * ((2.0 / 3.0) - t[i])); + else + t[i] = p; + } + } + } + catch (Exception ee) + { + throw new GFXConversionException("HSL Color Error", ee); + } + + return Color.FromArgb((int)(t[0] * 255), (int)(t[1] * 255), (int)(t[2] * 255)); + } + } + + /// + /// Modify the current HSL brightness + /// + /// brightness value + /// HSL + private HSL BrightnessHelper(double brightness) + { + try + { + this.L = this.L * brightness; + } + catch (Exception ee) + { + throw new GFXConversionException("HSL BrightnessHelper Error", ee); + } + + return new HSL(H, S, L); + } + + /// + /// Modify the current HSL brightness + /// + /// brightness value + /// HSL + public HSL Brightness(double brightness) + { + return this.BrightnessHelper(brightness); + } + + /// + /// Modify the current HSL brightness + /// + /// brightness value + /// Color + public Color BrightnessC(double brightness) + { + return this.BrightnessHelper(brightness).Color; + } + } +} \ No newline at end of file diff --git a/ColGen/Program.cs b/ColGen/Program.cs new file mode 100644 index 0000000..cb49ea0 --- /dev/null +++ b/ColGen/Program.cs @@ -0,0 +1,430 @@ +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; + } + } +} diff --git a/ColGen/Properties/AssemblyInfo.cs b/ColGen/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f823dde --- /dev/null +++ b/ColGen/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ColGen")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ColGen")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fac98cd8-dbc0-4d93-899c-4105aebde85e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ColGen/func.cs b/ColGen/func.cs new file mode 100644 index 0000000..5e12862 --- /dev/null +++ b/ColGen/func.cs @@ -0,0 +1,757 @@ +/** + This is tutorial code that goes with the article http://devmag.org.za/2012/07/29/how-to-choose-colours-procedurally-algorithms/. +*/ + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; + +using Christo.GFX.Conversion; + +namespace ProceduralPalette +{ + public static class RandomExtensions + { + public static int NextByte(this Random random) + { + return ProceduralPalette.FloatToByte(random.NextDouble()); + } + + public static float NextFloat(this Random random) + { + return (float) random.NextDouble(); + } + } + + class ProceduralPalette + { + + private static Random random = new Random(); + + public static List GenerateColors_Uniform(int colorCount) + { + List colors = new List(); + + for (int i = 0; i < colorCount; i++) + { + Color newColor = Color.FromArgb( + 255, + random.NextByte(), + random.NextByte(), + random.NextByte()); + + colors.Add(newColor); + } + + return colors; + } + + public static List GenerateColors_Harmony( + int colorCount, + float offsetAngle1, + float offsetAngle2, + float rangeAngle0, + float rangeAngle1, + float rangeAngle2, + float saturation, float luminance) + { + List colors = new List(); + + float referenceAngle = random.NextFloat() * 360; + + for (int i = 0; i < colorCount; i++) + { + float randomAngle = random.NextFloat() * (rangeAngle0 + rangeAngle1 + rangeAngle2); + + if (randomAngle > rangeAngle0) + { + if (randomAngle < rangeAngle0 + rangeAngle1) + { + randomAngle += offsetAngle1; + } + else + { + randomAngle += offsetAngle2; + } + } + + HSL hslColor = new HSL(((referenceAngle + randomAngle) / 360.0f) % 1.0f, saturation, luminance); + + colors.Add(hslColor.Color); + } + + return colors; + } + + public static List GenerateColors_Harmony2( + int colorCount, + float offsetAngle1, + float offsetAngle2, + float rangeAngle0, + float rangeAngle1, + float rangeAngle2, + float saturation, float saturationRange, + float luminance, float luminanceRange) + { + List colors = new List(); + + float referenceAngle = random.NextFloat() * 360; + + for (int i = 0; i < colorCount; i++) + { + float randomAngle = random.NextFloat() * (rangeAngle0 + rangeAngle1 + rangeAngle2); + + if (randomAngle > rangeAngle0) + { + if (randomAngle < rangeAngle0 + rangeAngle1) + { + randomAngle += offsetAngle1; + } + else + { + randomAngle += offsetAngle2; + } + } + + float newSaturation = saturation + (random.NextFloat() - 0.5f) * saturationRange; + float newLuminance = luminance + +(random.NextFloat() - 0.5f) * luminanceRange; + + HSL hslColor = new HSL(((referenceAngle + randomAngle) / 360.0f) % 1.0f, newSaturation, newLuminance); + + colors.Add(hslColor.Color); + } + + return colors; + } + + + public static List GenerateColors_RandomWalk(int colorCount, Color startColor, float min, float max) + { + List colors = new List(); + + Color newColor = startColor; + + float range = max - min; + + for (int i = 0; i < colorCount; i++) + { + int rSign = random.Next(2) % 2 == 0 ? 1 : -1; + int gSign = random.Next(2) % 2 == 0 ? 1 : -1; + int bSign = random.Next(2) % 2 == 0 ? 1 : -1; + + newColor = Color.FromArgb( + 255, + FloatToByte(ByteToFloat(newColor.R) + rSign * (min + random.NextDouble() * range)), + FloatToByte(ByteToFloat(newColor.G) + rSign * (min + random.NextDouble() * range)), + FloatToByte(ByteToFloat(newColor.B) + rSign * (min + random.NextDouble() * range))); + + colors.Add(newColor); + } + + return colors; + } + + public static List GenerateColors_RandomMix(int colorCount, Color color1, Color color2, Color color3, float greyControl, bool paint) + { + List colors = new List(); + + for (int i = 0; i < colorCount; i++) + { + Color newColor; + if (paint) + { + newColor = RandomMixHSL(color1, color2, color3, greyControl); + } + else + { + newColor = RandomMix(color1, color2, color3, greyControl); + } + colors.Add(newColor); + } + + return colors; + } + + public static List GenerateColors_RandomAdd(int colorCount, Color color1, Color color2, Color color3, float nonGrayBias) + { + List colors = new List(); + + for (int i = 0; i < colorCount; i++) + { + Color newColor = RandomAdd(color1, color2, color3, nonGrayBias); + + colors.Add(newColor); + } + + return colors; + } + + public static List GenerateColors_Offset(int colorCount, Color color, float maxRange) + { + List colors = new List(); + + for (int i = 0; i < colorCount; i++) + { + Color newColor = Color.FromArgb( + 255, + FloatToByte((ByteToFloat(color.R) + random.NextDouble() * 2 * maxRange - maxRange)), + FloatToByte((ByteToFloat(color.G) + random.NextDouble() * 2 * maxRange - maxRange)), + FloatToByte((ByteToFloat(color.B) + random.NextDouble() * 2 * maxRange - maxRange))); + + colors.Add(newColor); + } + + return colors; + } + + public static List GenerateColors_Hue(int colorCount, float saturation, float luminance) + { + List colors = new List(); + + for (int i = 0; i < colorCount; i++) + { + HSL hslColor = new HSL(random.NextDouble(), saturation, luminance); + + colors.Add(hslColor.Color); + } + + return colors; + } + + public static List GenerateColors_Saturation(int colorCount, float hue, float luminance) + { + List colors = new List(); + + for (int i = 0; i < colorCount; i++) + { + HSL hslColor = new HSL(hue, random.NextDouble(), luminance); + + colors.Add(hslColor.Color); + } + + return colors; + } + + public static List GenerateColors_Luminance(int colorCount, float hue, float saturation) + { + List colors = new List(); + + for (int i = 0; i < colorCount; i++) + { + HSL hslColor = new HSL(hue, saturation, random.NextDouble()); + + colors.Add(hslColor.Color); + } + + return colors; + } + + public static List GenerateColors_SaturationLuminance(int colorCount, float hue) + { + List colors = new List(); + + for (int i = 0; i < colorCount; i++) + { + HSL hslColor = new HSL(hue, random.NextDouble(), random.NextDouble()); + + colors.Add(hslColor.Color); + } + + return colors; + } + + public static List GenerateColors_GoldenRatioRainbow(int colorCount, float saturation, float luminance) + { + List colors = new List(); + + float goldenRatioConjugate = 0.618033988749895f; + float currentHue = (float) random.NextDouble(); + + + for (int i = 0; i < colorCount; i++) + { + HSL hslColor = new HSL(currentHue, saturation, luminance); + + colors.Add(hslColor.Color); + + currentHue += goldenRatioConjugate; + currentHue %= 1.0f; + + } + + return colors; + } + + public static List GenerateColors_GoldenRatioGradient(int colorCount, Color[] gradient, float saturation, float luminance) + { + List colors = new List(); + + float goldenRatioConjugate = 0.618033988749895f; + float currentHue = (float)random.NextDouble(); + + + for (int i = 0; i < colorCount; i++) + { + HSL hslColor = new HSL(currentHue, saturation, luminance); + + Color newColor = SampleLinearGradient(gradient, currentHue); + + colors.Add(newColor); + + currentHue += goldenRatioConjugate; + currentHue %= 1.0f; + + } + + return colors; + } + + public static List GenerateColors_HueRange(int colorCount, float startHue, float endHue, float saturation, float luminance) + { + List colors = new List(); + float hueRange = endHue - startHue; + + if(hueRange < 0) + { + hueRange += 1.0f; + } + + for (int i = 0; i < colorCount; i++) + { + float newHue = (float) (hueRange * random.NextDouble() + startHue); + + if(newHue > 1.0) + { + newHue -= 1.0f; + } + + HSL hslColor = new HSL(newHue, saturation, luminance); + + colors.Add(hslColor.Color); + } + + return colors; + } + + public static List GenerateColors_JitteredRainbow(int colorCount, float startHue, float endHue, float saturation, float luminance, bool jitter) + { + List colors = new List(); + float hueRange = endHue - startHue; + + if (hueRange < 0) + { + hueRange = 1 + hueRange; + } + + float cellRange = hueRange / colorCount; + float cellOffset = (float) (random.NextDouble() * cellRange); + + for (int i = 0; i < colorCount; i++) + { + float newHue; + if (jitter) + { + newHue = (float)(cellRange * i + random.NextDouble() * cellRange + startHue); + } + else + { + newHue = (cellRange * i + cellOffset + startHue); + } + + if(newHue > 1) + { + newHue -= 1.0f; + } + + HSL hslColor = new HSL(newHue, saturation, luminance); + + colors.Add(hslColor.Color); + } + + return colors; + } + + public static int FloatToByte(double value) + { + int byteValue = (int)(value * 256); + + byteValue = SaturateByte(byteValue); + + return byteValue; + } + + private static int SaturateByte(int byteValue) + { + if (byteValue > 255) + { + byteValue = 255; + } + else if (byteValue < 0) + { + byteValue = 0; + } + return byteValue; + } + + public static float ByteToFloat(int byteValue) + { + float floatValue = byteValue / 256.0f; + + return floatValue; + } + + public static Color RandomMix(Color color1, Color color2, Color color3, float greyControl) + { + int randomIndex = random.NextByte() % 3; + + float mixRatio1 = (randomIndex == 0) ? random.NextFloat() * greyControl : random.NextFloat(); + float mixRatio2 = (randomIndex == 1) ? random.NextFloat() * greyControl : random.NextFloat(); + float mixRatio3 = (randomIndex == 2) ? random.NextFloat() * greyControl : random.NextFloat(); + + float sum = mixRatio1 + mixRatio2 + mixRatio3; + + mixRatio1 /= sum; + mixRatio2 /= sum; + mixRatio3 /= sum; + + return Color.FromArgb( + 255, + (byte)(mixRatio1 * color1.R + mixRatio2 * color2.R + mixRatio3 * color3.R), + (byte)(mixRatio1 * color1.G + mixRatio2 * color2.G + mixRatio3 * color3.G), + (byte)(mixRatio1 * color1.B + mixRatio2 * color2.B + mixRatio3 * color3.B)); + } + + public static Color RandomMixHSL(Color color1, Color color2, Color color3, float greyControl) + { + int randomIndex = random.NextByte() % 3; + + float mixRatio1 = (randomIndex == 0) ? random.NextFloat() * greyControl : random.NextFloat(); + float mixRatio2 = (randomIndex == 1) ? random.NextFloat() * greyControl : random.NextFloat(); + float mixRatio3 = (randomIndex == 2) ? random.NextFloat() * greyControl : random.NextFloat(); + + float sum = mixRatio1 + mixRatio2 + mixRatio3; + + mixRatio1 /= sum; + mixRatio2 /= sum; + mixRatio3 /= sum; + + HSL hsl1 = new HSL(color1); + HSL hsl2 = new HSL(color2); + HSL hsl3 = new HSL(color3); + + return new HSL( + (mixRatio1 * hsl1.H + mixRatio2 * hsl2.H + mixRatio3 * hsl3.H), + (mixRatio1 * hsl1.S + mixRatio2 * hsl2.S + mixRatio3 * hsl3.S), + (mixRatio1 * hsl1.L + mixRatio2 * hsl2.L + mixRatio3 * hsl3.L)).Color; + } + + public static Color RandomMixPaint(Color color1, Color color2, Color color3, float greyControl) + { + int randomIndex = random.NextByte() % 3; + + float mixRatio1 = (randomIndex == 0) ? random.NextFloat() * greyControl : random.NextFloat(); + float mixRatio2 = (randomIndex == 1) ? random.NextFloat() * greyControl : random.NextFloat(); + float mixRatio3 = (randomIndex == 2) ? random.NextFloat() * greyControl : random.NextFloat(); + + float sum = mixRatio1 + mixRatio2 + mixRatio3; + + mixRatio1 /= sum; + mixRatio2 /= sum; + mixRatio3 /= sum; + + return Color.FromArgb( + 255, + 255 - (byte)(mixRatio1 * (255 - color1.R) + mixRatio2 * (255 - color2.R) + mixRatio3 * (255 - color3.R)), + 255 - (byte)(mixRatio1 * (255 - color1.G) + mixRatio2 * (255 - color2.G) + mixRatio3 * (255 - color3.G)), + 255 - (byte)(mixRatio1 * (255 - color1.B) + mixRatio2 * (255 - color2.B) + mixRatio3 * (255 - color3.B))); + } + + public static Color RandomAdd(Color color1, Color color2, Color color3, float nonGrayBias) + { + int rIndex = random.NextByte() % 3; + + float r1 = (rIndex == 0) ? random.NextFloat() * nonGrayBias : random.NextFloat(); + float r2 = (rIndex == 1) ? random.NextFloat() * nonGrayBias : random.NextFloat(); + float r3 = (rIndex == 2) ? random.NextFloat() * nonGrayBias : random.NextFloat(); + + float p = 20; + float sum = (float) Math.Pow( + Math.Pow(r1, p) + + Math.Pow(r2, p) + + Math.Pow(r3, p), 1 / p); + + + + r1 /= sum; + r2 /= sum; + r3 /= sum; + + return Color.FromArgb( + 255, + SaturateToByte(r1 * color1.R + r2 * color2.R + r3 * color3.R), + SaturateToByte(r1 * color1.G + r2 * color2.G + r3 * color3.G), + SaturateToByte(r1 * color1.B + r2 * color2.B + r3 * color3.B)); + } + + public static int SaturateToByte(float floatValue) + { + int intValue = (int)floatValue; + + if (intValue > 255) + { + intValue = 255; + } + else if( intValue < 0) + { + intValue = 0; + } + + return intValue; + } + + public static Color SampleLinearGradient(Color [] colors, float t) + { + int colorCount = colors.Length; + int leftIndex = (int) (t * colorCount); + + float cellRange = 1.0f / colorCount; + float alpha = (t - leftIndex * cellRange) / cellRange; + + Color leftColor = colors[leftIndex]; + Color rightColor = colors[(leftIndex + 1) % colorCount]; + + return Color.FromArgb( + 255, + (byte) (leftColor.R * (1 - alpha) + rightColor.R * (alpha)), + (byte) (leftColor.G * (1 - alpha) + rightColor.G * (alpha)), + (byte) (leftColor.B * (1 - alpha) + rightColor.B * (alpha))); + } + + public static Bitmap GeneratePaletteImage(List colors, int width, int height, int spacing) + { + Bitmap image = new Bitmap(width, height); + int colorCount = colors.Count; + int blockWidth = (width - ((colorCount - 1) * spacing)) / colorCount; + + for (int i = 0; i < colorCount; i++) + { + DrawBlock(image, i * (blockWidth + spacing), 0, blockWidth, height, colors[i]); + } + + return image; + } + + + + public static void DrawBlock(Bitmap image, int x, int y, int width, int height, Color color) + { + for (int i = x; i < x + width; i++) + { + for (int j = y; j < y + height; j++) + { + image.SetPixel(i, j, color); + } + } + } + + //static void Main(string[] args) + //{ + // //random = new Random(15);//15 + // random = new Random(12);//15 + // List colors; + // int versionCount = 3; + // int colorCount = 20; + + // 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 + // }; + + + // for (int version = 0; version < versionCount; version++) + // { + // colors = GenerateColors_Uniform(colorCount); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Uniform_5_" + version + ".png"); + + // colors = GenerateColors_RandomWalk(colorCount, baseColors[version], 0.2f, 0.4f); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("RandomWalk_5_" + version + ".png"); + + // colors = GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.1f, true); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("MixPaint1_5_" + version + ".png"); + + // colors = GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.5f, true); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("MixPaint5_5_" + version + ".png"); + + // colors = GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.9f, true); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("MixPaint9_5_" + version + ".png"); + + // colors = GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.1f, false); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Mix1_5_" + version + ".png"); + + // colors = GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.5f, false); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Mix5_5_" + version + ".png"); + + // colors = GenerateColors_RandomMix(colorCount, mixColor1[version], mixColor2[version], mixColor3[version], 0.9f, false); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Mix9_5_" + version + ".png"); + + // colors = GenerateColors_RandomAdd(colorCount, addColor1[version], addColor2[version], addColor3[version], 0.1f); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Add1_5_" + version + ".png"); + + // colors = GenerateColors_RandomAdd(colorCount, addColor1[version], addColor2[version], addColor3[version], 0.5f); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Add5_5_" + version + ".png"); + + // colors = GenerateColors_RandomAdd(colorCount, addColor1[version], addColor2[version], addColor3[version], 0.9f); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Add9_5_" + version + ".png"); + + // colors = GenerateColors_Offset(colorCount, baseColors[version], 0.4f); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Offset_5_" + version + ".png"); + + // colors = GenerateColors_Hue(colorCount, saturation[version], luminance[version]); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Hue_5_" + version + ".png"); + + // colors = GenerateColors_Saturation(colorCount, hueStart[version], luminance[version]); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Saturation_5_" + version + ".png"); + + // colors = GenerateColors_Luminance(colorCount, hueStart[version], saturation[version]); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Luminance_5_" + version + ".png"); + + // colors = GenerateColors_SaturationLuminance(colorCount, hueStart[version]); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Saturation_Luminance_5_" + version + ".png"); + + // colors = GenerateColors_GoldenRatioRainbow(colorCount, saturation[version], luminance[version]); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("GoldenRatioRainbow_5_" + version + ".png"); + + // colors = GenerateColors_GoldenRatioGradient(colorCount, gradients[version], saturation[version], luminance[version]); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("GoldenRatioGradient_5_" + version + ".png"); + + // colors = GenerateColors_JitteredRainbow(colorCount, 0, 1, saturation[version], luminance[version], true); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("JitteredRainbow_5_" + version + ".png"); + + // colors = GenerateColors_JitteredRainbow(colorCount, hueStart[version], hueEnd[version], saturation[version], luminance[version], true); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("JitteredRainbowRange_5_" + version + ".png"); + + // colors = GenerateColors_JitteredRainbow(colorCount, 0, 1, saturation[version], luminance[version], false); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Grid_Rainbow_5_" + version + ".png"); + + // colors = GenerateColors_HueRange(colorCount, hueStart[version], hueEnd[version], saturation[version], luminance[version]); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("HueRange_5_" + version + ".png"); + + // colors = GenerateColors_Harmony(colorCount, + // offsetAngles1[version], offsetAngles2[version], + // angleRanges1[version], angleRanges2[version], angleRanges3[version], + // saturation[version], luminance[version]); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Harmony_5_" + version + ".png"); + + // colors = GenerateColors_Harmony2(colorCount, + // offsetAngles1[version], offsetAngles2[version], + // angleRanges1[version], angleRanges2[version], angleRanges3[version], + // saturation[version], 0.2f, + // luminance[version], 0.5f); + // GeneratePaletteImage(colors, imageWidth, imageHeight, spacing).Save("Harmony2_5_" + version + ".png"); + // } + //} + } +}