private static RYB clamp(RYB c) { c.Blue = Mathf.Clamp01(c.Blue); c.Red = Mathf.Clamp01(c.Red); c.Yellow = Mathf.Clamp01(c.Yellow); return(c); }
//Generates a color palette with a given color count public static IEnumerable <Color> Generate(int numOfColors) { var points = new Points(numOfColors); foreach (var point in points) { var rgb = RYB.ToRgb(point[0], point[1], point[2]); yield return(new Color( (int)Math.Floor(255 * rgb[0]), (int)Math.Floor(255 * rgb[1]), (int)Math.Floor(255 * rgb[2]))); } }
public static IEnumerable <Vector3> Generate(int numOfColors) { var points = new Points(numOfColors); foreach (var point in points) { var rgb = RYB.ToRgb(point[0], point[1], point[2]); yield return(new Vector3((float)rgb[0], (float)rgb[1], (float)rgb[2])); //yield return Color.FromArgb( // (int)Mathf.Floor(255 * rgb[0]), // (int)Mathf.Floor(255 * rgb[1]), // (int)Mathf.Floor(255 * rgb[2])); } }
public bool Equals(RYB o) { return(o.Red == Red && o.Yellow == Yellow && o.Blue == Blue); }