Get consecutive 'rainbow' colors

Challenge:

Get ‘n’ number of colors which are consecutive in the rainbow.

Note: the input nr ‘n’ has to be able to change, so its alo possible its 8, or 25…

2023-12-26 Generate cesecutive rainbow colors.gh (16.3 KB)

Any suggestions?

See ColorJ and ColorB clusters here:

Also ColorJa and ColorBa (adds ‘A’ inputs for transparency)

1 Like

I would think the easiest way to use the Gradient component. Something like this should work.

Gradient Lines.gh (8.9 KB)

1 Like

This is easier. I use these ColorJa and ColorBa clusters all the time. They are not password-protected so can be edited to see how they work.

Gradient Line_2023Dec26a
Gradient Line_2023Dec26a.gh (13.0 KB)

Internals of the ColorJ cluster:

Gradient Line_2023Dec26a2

2 Likes

Hi,

Thank you both!

It worked to get the ‘rainbow’ colors.

Howeveer when having another critical look at it I found out I would like to get a more ‘result’ based color range something like:
green → Yellow → light blue → dark blue → yellow → orange → red.

Any suggestions?

Many thanks :slight_smile:

You can right-click on the Gradient component and select a gradient preset… Or you can edit the colors/positions yourself directly by double clicking on the Gradient component.

1 Like

The trouble with a list of colors is that when geometry changes, the color list must also be changed.