rainbow

Help Contents Color management rainbow
rgb_ colors

rainbow :x


This is a function for creating rainbow colors.

x: (number) should be in the range 0..1 for good results.

Definition:

to rainbow :x

	if x < 1/4 
	[
		output rgb_ 4*x 0 2/4-2*x
	]
	[
		if x < 2/4 
		[
			output rgb_ 1 4*x-1 0
		]
		[
			if x < 3/4 
			[
				output rgb_ 3-4*x 1 4*x-2
			]
			[
				output rgb_ (4*x-3)/2 4-4*x 1
			]
		]
	]
end

Examples:

References:

rgb_ colors