Color3

< Global namespace | ROBLOX namespace

A real-valued RGB color tuple, with elements ranging from [0,1]. The Color3 data type is often used in setting the colors of objects that aren't related to bricks, such as GUIs, Sparkles, etc.

Quick Reference[edit]

Constructors
SyntaxDescription
Color3.fromHSV(number hue, number sat, number val)Creates a new Color3 using HSV values from 0 to 1.
Color3.fromRGB(int r, int g, int b)Creates a new Color3 using RGB integer values between 0 and 255.
Color3.new(number r, number g, number b)Creates a new Color3 using RGB values between 0 and 1.
Color3.new()Creates a Color3 whose values are (0,0,0) [black]
Color3.toHSV(Color3 color)Returns the HSV representation of a Color3 as 3 numbers (with values between 0-1)
Properties
SyntaxDescription
number b The B component of the Color3's RGB channels, as a number between 0 and 1.
number g The G component of the Color3's RGB channels, as a number between 0 and 1.
number r The R component of the Color3's RGB channels, as a number between 0 and 1.
Functions
SyntaxDescription
Color3 Color3:lerp(Color3 goal, number alpha)Returns a Color3 interpolated between this Color3 and the goal by the fraction alpha.

Constructors[edit]

These Constructors are used for creating Color3 values.

Color3.new[edit]

Color3 Color3.new()

Description:
Creates a Color3 whose values are (0,0,0) [black]

Color3 Color3.new(number r, number g, number b)

Description:
Creates a new Color3 using RGB values between 0 and 1.

Color3.fromRGB[edit]

Color3 Color3.fromRGB(int r, int g, int b)

Description:
Creates a new Color3 using RGB integer values between 0 and 255.

Color3.fromHSV[edit]

Color3 Color3.fromHSV(number hue, number sat, number val)

Description:
Creates a new Color3 using HSV values from 0 to 1.

Color3.toHSV[edit]

number, number, number Color3.toHSV(Color3 color)

Description:
Returns the HSV representation of a Color3 as 3 numbers (with values between 0-1)

Properties[edit]

r[edit]

number Color3.r [readonly]

Description:
The R component of the Color3's RGB channels, as a number between 0 and 1.

g[edit]

number Color3.g [readonly]

Description:
The G component of the Color3's RGB channels, as a number between 0 and 1.

b[edit]

number Color3.b [readonly]

Description:
The B component of the Color3's RGB channels, as a number between 0 and 1.

Methods[edit]

lerp[edit]

Color3 Color3:lerp(Color3 goal, number alpha)

Description:
Returns a Color3 interpolated between this Color3 and the goal by the fraction alpha.

Converting BrickColor in to Color3[edit]

You can easily convert your BrickColor into Color3 format by simply doing something like this!

local brickcolor = BrickColor.new("Really red") --Create our new BrickColor
local color = brickcolor.Color --BrickColors have a Color property that returns their Color3

See Also[edit]