It’s been a long time coming, but we need more operators color Color3. Ever since the release of gui (2010, I believe), the uses for Color3s have exploded. Before, it’s use was exclusive only to Sparkles. Because there aren’t any operators for Color3, we have to do arithmetic on each component separately. For example, to tween from one color to another, we have to use code that looks something like this:
local function tweenColor(c0, c1, a) -- c0: starting color, c1: ending color, a: alpha
local r0, g0, b0 = c0.r, c0.g, c0.b
local r1, g1, b1 = c1.r, c1.g, c1.b
return ( Color3.new(r0 + (r1 - r0) * a, g0 + (g1 - g0) * a, b0 + (b1 - b0) * a) )
end
Code like this isn’t really newb-friendly, and, considering that functions like these are called per frame, running this on several objects can be costly.
Here is a table of operators I shamelessly ripped off from Vector3:
[table]
[tr]
[td]Color3 u + Color3 v[/td]
[td]Adds each component of u to its corresponding component in v[/td]
[/tr]
[tr]
[td]Color3 u - Color3 v[/td]
[td]Subtracts each component of v to its corresponding component in v[/td]
[/tr]
[tr]
[td]Color3 u / Color3 v[/td]
[td]Divides each component of u by its corresponding component in v[/td]
[/tr]
[tr]
[td]Color3 u * Color3 v[/td]
[td]Multiplies each component of u by its corresponding component in v[/td]
[/tr]
[tr]
[td]number k * Color3 v
Color3 v * number k[/td]
[td]Multiplies each component of v by k[/td]
[/tr]
[tr]
[td]Color3 v / number k [/td]
[td]Divides each component of v by k[/td]
[/tr]
[tr]
[td]number k / Color3 v[/td]
[td]Returns a Color3 with k divided by each component of v[/td]
[/tr]
[/table]
With these operators in place, the code on top can be simplified to:
tweenedColor = c0 + (c1 - c0) * a