Rotate through all colors?

Hey guys,

I’m in a bit of a pickle with this problem. How the heck can I create a function which rotates a uint value gradually through all colors? E.g, start with red, fade to yellow, then green, blue etc. over time then back to red.

Been rattling my noggin (and google) now for a while but come up with nothing that wouldn’t be insanely long-winded. There must be an easy-ish way to do this?