[HSV Adjust TOP, rainbow gradient] Is it possible to use arrays as parameter values, like vvvv's spread paradigm?

I want to make a rainbow gradient, where the hue changes, and the saturation and value stay the same.
I’m coming from vvvv, where I can easily set up something like the image below:

My first instinct in TouchDesigner would be to enter an array as the HSV Adjust TOP’s “Hue Offset” parameter. Is this possible somehow? My solution didn’t work:

image

I was able to get further with a Texture3D TOP + a Pattern CHOP, which I could probably use somehow, but it’s not as elegant as vvvv’s spreads.

The RGB solution below is more like what I have in mind, but I would prefer working with HSV/HSB/HSL. I could probably find a Python function and implement it in TD, but I’d rather do something like this:

hi,

you will want to use a RampTOP with chosen colors.
if you need to modify colors you can alter the ramp_keys DAT docked to it (purple arrow on the bottom right of the RampTOP) which stored the values.

You can change from RGB to HSV by clicking the little colored square on the left of the ramp, but for modifying the colors from the ramp_keys DAT you’ll have to deal with RGB or a custom solution

I’m unsure about the Ramp TOP for my needs. It would be great if I could provide an array of numbers to its Hue parameter, or manipulate the position points.

In the first post’s vvvv screenshot, I can go from a full rainbow to a subtle red to yellow gradient, just by changing the input and width parameters. I can also get a low-res gradient by changing the spread count parameter.

It seems like I might need a custom solution. This thread seems interesting: python - HSV to RGB Color Conversion - Stack Overflow

i see.
you can of course start from a table of values but again dealing with RGB…
Though you could start with a HSV table and add a HSVtoRGB TOP after the ChopTo

i guess your best bet would be using GLSL

Thanks! I was able to write my first shader, which suits my basic gradient needs for now:

out vec4 fragColor;
uniform float startingHue;
uniform float hueDistance;

// https://gist.github.com/yiwenl/745bfea7f04c456e0101
vec3 hsv2rgb(vec3 c)
{
	vec4 K=vec4(1.,2./3.,1./3.,3.);
	vec3 p=abs(fract(c.xxx+K.xyz)*6.-K.www);
	return c.z*mix(K.xxx,clamp(p-K.xxx,0.,1.),c.y);
}

void main()
{
	vec4 color=vec4(hsv2rgb(vec3(startingHue + (vUV.s * hueDistance),.75,1)),1);
	fragColor=TDOutputSwizzle(color);
}