advice needed for color selection

D

Dr Eberhard Lisse

Hi,

I have a variable number of entities (from an SQL script) each of which
I want to assign a color to so I can print them with GraphViz.

How do I select the most visible colors?

Ie if I have 10, 30, 57, 98, 259 entities, how do I select appropriate
colours (dynamically, so to speak) so that they (and of course arrows
originating from them but that is easy to do in GraphViz) become most
visible on (white) paper?

Pointers are as welcome as finished product :)-O


el
 
P

Peter J. Holzer

I have a variable number of entities (from an SQL script) each of which
I want to assign a color to so I can print them with GraphViz.

How do I select the most visible colors?

Ie if I have 10, 30, 57, 98, 259 entities, how do I select appropriate
colours (dynamically, so to speak) so that they (and of course arrows
originating from them but that is easy to do in GraphViz) become most
visible on (white) paper?

Pointers are as welcome as finished product :)-O

Some ideas:

The perceived brightness of a color is approximately 0.3*R + 0.6*G + 0.1*B.
When printing on paper, you may want to exclude colors which are too
bright. So one idea is to generate random colors and reject those where
the brightness is above some threshold.

You probably want your colors evenly spread out. A purely random
distribution may result in some colors being very close together. So you
could apply a spring model to the colors to improve the distribution.

Or you could generate a regular 3D-Grid (with the bright area cut out)
by generating a sufficient number of regularly spaced colors and then
keeping only the darkest.

In any case you probably want to apply some gamma correction after that.

When generating colored graphs with random colors I have found it useful
to cache the colors so that the each entity keeps its color between runs
(and only new entities are assigned new colors).

hp
 
D

Dr Eberhard Lisse

Peter,

thank you very much.

In the end I took the X11 colors by name, whittled out the bright
ones manually and put the rest in an array. I increment a counter
each time a color is used and when I reach the maximum I set it back
to zero and reuse.

That works out reasonably well :)-O

el
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top