I was bored during the week-end and made this for you @EatThePath

It should work as intended (I don’t have HW2 installed at the moment).

Base and Stripe colors are managed separately and the rainbow cycle can be inverted for each one easily with Base_Inversion and Stripe_Inversion.

The HSV/RGB conversion is based on this site : http://www.rapidtables.com/convert/color/hsv-to-rgb.htm

Tell me if you have any problem with it.

```
function OnInit()
Rule_Add("Rule_Rainbow")
end
Base_Inversion=0 -- if set to 1, the Base will go "red/magenta/blue/cyan/green/yellow/red" instead of "red/yellow/green/cyan/blue/magenta/red"
Base_h=0 -- hue start value from 0° to 360°
Base_s=1 -- saturation from 0 to 100% (1=100%)
Base_v=1 -- value from 0 to 100% (1=100%)
Stripe_Inversion=0 -- if set to 1, the Stripe will go "red/magenta/blue/cyan/green/yellow/red" instead of "red/yellow/green/cyan/blue/magenta/red"
Stripe_h=0 -- hue start value from 0° to 360°
Stripe_s=1 -- saturation from 0 to 100% (1=100%)
Stripe_v=1 -- value from 0 to 100% (1=100%)
function Rule_Rainbow()
SobGroup_SetTeamColours("Player_Ships0", HSVtoRGB(Base_h,Base_s,Base_v), HSVtoRGB(Stripe_h,Stripe_s,Stripe_v), "DATA:Badges/Soban.tga")
If Base_Inversion == 1 then
If Base_h == 0 then Base_h = 360 end
Base_h = Base_h - 1
else
If Base_h == 360 then Base_h = 0 end
Base_h = Base_h + 1
end
If Stripe_Inversion == 1 then
If Stripe_h == 0 then Stripe_h = 360 end
Stripe_h = Stripe_h - 1
else
If Stripe_h == 360 then Stripe_h = 0 end
Stripe_h = Stripe_h + 1
end
end
function HSVtoRGB(h,s,v)
local rgb_table = {}
local c,x,o
-- verify that h, s and v are within correct boundaries
if (h<0) or (h>=360) then h=0 end
if s<0 then s=0 end
if s>1 then s=1 end
if v<0 then v=0 end
if v>1 then v=1 end
c = v
x = v*(1-s*abs(mod(h/60, 2)-1))
o = v*(1-s)
-- c, x and o should never be <0 or >1 but just in case...
if c<0 then c=0 end
if c>1 then c=1 end
if x<0 then x=0 end
if x>1 then x=1 end
if o<0 then o=0 end
if o>1 then o=1 end
if h<60 then
rgb_table = {c, x, o}
elseif h<120 then
rgb_table = {x, c, o}
elseif h<180 then
rgb_table = {o, c, x}
elseif h<240 then
rgb_table = {o, x, c}
elseif h<300 then
rgb_table = {x, o, c}
else
rgb_table = {c, o, x}
end
return rgb_table
end
```