Gradient colors ramp Shader Node - Vertical and static (animated object)
As @Allen Simpson has commented:
If you use a single cyclic Bezier curve, given thickness with its native Bevel, (set in its  Data tab &gt; Geometry panel,) it is automatically mapped 0-&gt;1 in U along its length.
So a node arrangement like this can set the color-ramp's range of colors along its length:

The Add and Wrap nodes are optional: changing the 'Add' value shifts the whole range along the curve.