"Adam Hartshorne" <> wrote in message
news:43daa802$...
> Hi All,
>
> I was wondering if somebody could post a few lines of code which would
> produce random colors, which will be used in defining different regions on
> a mesh. So in addition to having n random colors, I feel that there should
> also be some condition to ensure that they aren't too similar in
> appearance, given that is likely to range from 2-20 say.
>
> Any help much appreciated,
>
> Adam
The problem you pose isn't trivial in general. The outline is this: starting
from RGB compute XYZ (based on some calibration you must know) and hence to
Lab space. Select a color difference formula such as CIE2000 and you can
then compute the difference in color between all pairs of patches. Now you
still need something like an annealing algorithm to maximize the minimum
color difference.
However, if you only expect to have 20 colors on screen at one time I would
just pick 20 colors from a palette using any decent image editor. That's a
whole lot more practical.