Programmatically Change Colors in C#

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-04-03T18:46:36Z Indexed on 2010/04/03 18:53 UTC
Read the original article Hit count: 138

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about color