Ejemplo n.º 1
0
 void Analogous()
 {
     for (int i = 0; i < 5; i++)
     {
         targetPalette.colors[i].rgb = baseColor.ToHSV().ShiftHue(15 * (i - 2)).ToColor();
         if ((i + 1) % 2 == 0)
         {
             ColorHelper.ColorHSV hsv = targetPalette.colors[i].rgb.ToHSV();
             hsv.s *= 0.8f;
             hsv.v  = Mathf.Min(hsv.v * 1.2f, 1f);
             targetPalette.colors[i].rgb = hsv.ToColor();
         }
     }
 }
Ejemplo n.º 2
0
 void Monochromatic()
 {
     for (int i = 0; i < 5; i++)
     {
         ColorHelper.ColorHSV hsv = baseColor.ToHSV();
         if ((i + 2) % 3 == 0)
         {
             if (hsv.s > 0.5f)
             {
                 hsv.s = hsv.s / 1.5f;
             }
             else
             {
                 hsv.s = hsv.s * 1.5f;
             }
         }
         else if (i % 3 == 0)
         {
             if (hsv.s > 0.5f)
             {
                 hsv.s = Mathf.Min(hsv.s * 1.5f, 1f);
             }
             else
             {
                 hsv.s = hsv.s / 1.5f;
             }
         }
         if ((i + 1) % 2 == 0)
         {
             if (hsv.v > 0.5f)
             {
                 hsv.v = hsv.v / 1.5f;
             }
             else
             {
                 hsv.v = hsv.v * 1.5f;
             }
         }
         targetPalette.colors[i].rgb = hsv.ToColor();
     }
 }
Ejemplo n.º 3
0
 void AnalogousAccent()
 {
     for (int i = 0; i < 5; i++)
     {
         targetPalette.colors[i].rgb = baseColor.ToHSV().ShiftHue(15 * (i - 2)).ToColor();
         if ((i + 1) % 2 == 0)
         {
             ColorHelper.ColorHSV hsv = targetPalette.colors[i].rgb.ToHSV();
             hsv.s *= 0.8f;
             hsv.v  = Mathf.Min(hsv.v * 1.2f, 1f);
             hsv.ShiftHue(180f);
             targetPalette.colors[i].rgb = hsv.ToColor();
         }
     }
     ColorHelper.ColorHSVRGB temp = targetPalette.colors[1];
     targetPalette.colors.RemoveAt(1);
     targetPalette.colors.Add(temp);
     temp = targetPalette.colors[2];
     targetPalette.colors.RemoveAt(2);
     targetPalette.colors.Add(temp);
 }
Ejemplo n.º 4
0
 float ColorDistanceHSVCylinder(Color c1, Color c2)
 {
     ColorHelper.ColorHSV c1hsv = new ColorHelper.ColorHSV(c1);
     ColorHelper.ColorHSV c2hsv = new ColorHelper.ColorHSV(c2);
     return(Vector3.Distance(Quaternion.AngleAxis(c1hsv.h, Vector3.up) * (Vector3.right * c1hsv.v + Vector3.up * c1hsv.s), Quaternion.AngleAxis(c2hsv.h, Vector3.up) * (Vector3.right * c2hsv.v + Vector3.up * c2hsv.s)));
 }