I need to generate random color names e.g. “Red”, “White” etc. How can I do it? I am able to generate random color like this:
Random randonGen = new Random();
Color randomColor = Color.FromArgb(randonGen.Next(255), randonGen.Next(255),
randonGen.Next(255));
but I need the names and not all colors generated like this have a known name.
Thanks
Use
Enum.GetValueto retrieve the values of theKnownColorenumeration and get a random value: