示例#1
0
    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);
    }
示例#2
0
        //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])));
            }
        }
示例#3
0
    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]));
        }
    }
示例#4
0
 public bool Equals(RYB o)
 {
     return(o.Red == Red && o.Yellow == Yellow && o.Blue == Blue);
 }