Some hue algorithms can appear overly choppy when dealing with color blending.
Most programmers seem to use linear algorithms to calculate hue, but the complexity, speed, and overall look can be greatly improved by simply implementing SINE as the blending method.
This definition will change GCOLOR depending on what hues and values are given to it:
'1st parameter = hue = 0 to 1 will cover the entire spectrum
'2nd parameter = value = 0 (black) to 1, anything above 1 will separate the colors further
DEF HUE H,V
VAR R,G,B,P=PI()
R=SIN(P*H)*V
G=SIN(P*(H+1/3))*V
B=SIN(P*(H+2/3))*V
GCOLOR RGB(R*R*255,G*G*255,B*B*255)
END
Here is a test program:
FOR Y=0 TO 240
FOR X=0 TO 400
HUE X/400,Y/240*2
GPSET X,Y
NEXT
NEXT
GLINE 0,120,400,120,#WHITE
Which will display this output:
Where the white line represents a value of one, a.k.a. a perfect hue.
Limitations
Only hue and value can be controlled, no saturation, therefore this function cannot cover every possible color, but only those that are considered hue colors.