samedi 14 mai 2016

How to generate randomly colors that is easily recognizable from each other?

I want to generate random colors for a graphic chart but what I tried is not recognizable and generated color are similar to each other generally. Is it possible to create such colors?

My method:

    public Color[] GenerateColors(int n)
    {
        Color[] colors = new Color[n];
        for (int i = 0; i < n; i++)
        {
            int R = rnd.Next(0, 250);
            int G = rnd.Next(0, 250);
            int B = rnd.Next(0, 250);

            Color color = Color.FromArgb(R, G, B);
            colors[i] = color;
        }
        return colors;
    }




Aucun commentaire:

Enregistrer un commentaire