Quantcast
Channel: NodeXL: Network Overview, Discovery and Exploration for Excel
Viewing all articles
Browse latest Browse all 4386

New Post: Generate random dark colors?

$
0
0
You said "background," Doug.

But the principal for vertices is the same. Again, I'm typing this without actually trying it, so caveat emptor:
const Int32 MaximumColorComponentValue = 50;
Random random = new Random();

foreach (IVertex vertex in nodeXLControl.Graph.Vertices)
{
  System.Drawing.Color randomDarkColor = System.Drawing.Color.FromArgb(
    random.Next(MaximumColorComponentValue),
    random.Next(MaximumColorComponentValue),
    random.Next(MaximumColorComponentValue)
    );

  vertex.SetValue(ReservedMetadataKeys.PerColor, randomDarkColor);
}
-- Tony

Viewing all articles
Browse latest Browse all 4386

Trending Articles