Color3
Color3 is a datatype used for working with colors. Each component (red, green, blue) is stored as a floating-point value between 0 and 1, where 0 represents no intensity and 1 represents full intensity.
Properties
r
number Read-onlyThe red component of the color (0-1)
g
number Read-onlyThe green component of the color (0-1)
b
number Read-onlyThe blue component of the color (0-1)
Methods
fromRGB(r: number, g: number, b: number)
Color3Creates a Color3 from RGB values in the range 0-255
Parameters:
rnumber - Red component (0-255)gnumber - Green component (0-255)bnumber - Blue component (0-255)
local orange = Color3.fromRGB(255, 165, 0)
fromHSV(h: number, s: number, v: number)
Color3Creates a Color3 from HSV (Hue, Saturation, Value) color space
Parameters:
hnumber - Hue (0-1)snumber - Saturation (0-1)vnumber - Value/Brightness (0-1)
-- Create a bright green
local green = Color3.fromHSV(0.333, 1, 1)
Returns a Color3 linearly interpolated between this color and the target color
Parameters:
otherColor3 - The target color to interpolate towardsalphanumber - The interpolation factor (0-1)
local red = Color3.new(1, 0, 0)
local blue = Color3.new(0, 0, 1)
local purple = red:Lerp(blue, 0.5)