Color3
Summary
Constructors
Constructors of a `Color3`.Properties
R
NumberThe red value of the color.
G
NumberThe green value of the color.
B
NumberThe blue value of the color.
Constructors
new(R: Number, G: Number, B: Number)
Color3Returns a new
Color3from the given values. Values range from0to1.
fromRGB(R: Number, G: Number, B: Number)
Color3Returns a new
Color3from the given values. Values range from0to255.
Methods
Lerp()
Color3
color:Lerp(other: Color3, alpha: Number)Returns a component-wise linear interpolation between
colorandother.
Parameters
other:Color3— the target color.alpha:Number— the interpolation amount, from0to1.
Examples
Use fromRGB when working with familiar 0 to 255 color values. Use new
when the components are already normalized from 0 to 1:
local orangeFromRGB = Color3.fromRGB(255, 128, 0)local orangeNormalized = Color3.new(1, 128 / 255, 0)
local part = workspace:FindFirstChild("MyPart")if part then part.Color = orangeFromRGBendLerp creates a color between two endpoints. An alpha of 0 returns the
starting color, 1 returns the target, and 0.5 returns the midpoint:
local red = Color3.fromRGB(255, 0, 0)local blue = Color3.fromRGB(0, 0, 255)local purple = red:Lerp(blue, 0.5)Testing Notes
The previously listed Color3.fromHSV and Color3.fromHex constructors were
removed from this reference because they are not exposed in Vortex Studio
0.3.4. Runtime availability may change in later releases.
The examples above were revalidated in Vortex Studio 0.3.8.
Color3.fromRGB(255, 128, 0) produced approximately (1, 0.502, 0), and the
red-to-blue midpoint produced (0.5, 0, 0.5).