Is there an easier way to do all of this?

dpmattox:

switch(chan) 
  1. {
  2. case 0:
  3. r = 0; // 0
  4. g = r++; // 1
  5. b = g++; // 2
  6. break; // I'll admit, I thought the increments looked a lot cooler than r=0, g=1, b=2 (yes, I am a bit immature)

The uncool version does have the advantage of giving you the right answer, though.
Fortunately, when you get fed up with debugging the 'cool' version you can replace the whole thing with :

r = chan/3; 
g = r + 1; 
b = g + 1;