World position, component mask RG, divide, sine, then lerp between your colors. This will produce an oscillating sine wave throughout the world and use the mesh’s position to calculate the coloring.
If you want 3 colors, that’s trickier. I’ve done this before, but I’m not sure if my method is the most appropriate. I imagine at a certain point it would be much cheaper to use a texture to reference colors, and just plug the world position in UVs. That’s what I do to make colored lines over mountain rocks.