tags:

views:

337

answers:

1

I am current working on a project where, as different users add text to a document, I would like the color of the text to change.

Originally, I was using C#'s predefined color values and just putting the ones I wanted to use into an enum in my application and cycling through the colors as different users added annotations. This works fine, and I am okay with this solution.

However, I also could have chosen to change the RGB values and derived colors that way. I'm curious about what type of algorithm would be good to change those values to get different sets of colors. This is more just an exercise of something I had thought about.

To clarify a little bit, I don't want to just increment one of the color values (R, G, or B) because that wouldn't give me enough variety in my colors. But, I don't think it would also work to increment all three of equal amounts. I also have to watch out for repeating colors (up to a point). The requirements for my project anticipates, at most, 10 different reviewers.

+3  A: 

The best thing to do for this kind of problem is use HSL or HSV values and vary just the hue. Then convert back to RGB.

See this link for more information.

Brian R. Bondy
Thanks, Brian. Wow, that's a lot more simple than I thought. Pretty neat solution.
JasCav
@Jason: Ya it definitely seems more complicated because when you work with a color model that doesn't match what you want to do, it *is* harder.
Brian R. Bondy