Cycling images color palette

I’ve been trying to figure out a nice way to cycle the colors of a
surface. What I’m specifically trying to do is bleed the color from a
surface, leaving it greyscale… and then (after the user does a certain
thing) the original color palette slides back into the surface. I’ve been
looking to the palette fading routine in the online documentation, but
can’t figure out what I might need to change in my case.

I’m sure there’s an easy way to do this, I just can’t grok the SDL color
functions and such.–
Sam Hart http://www.physics.arizona.edu/~hart/
Web Page Highlights: Video Game History, Black Hole Simulation, & more.
OTHER WEB SITES MAINTAINED BY SAM HART
http://www.geekcomix.com/ - Geekcomix, the Daily Geek Comic Strip Site
http://www.physics.arizona.edu/~hart/gw/ - Ghostworks (Alt./Linux Computing)