Color3

From Legacy Roblox Wiki
Jump to navigationJump to search

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.

Constructors

Constructor Description
Color3.new() Creates a new Color3 for black (0,0,0).
Color3.new(r, g, b) Creates a new Color3.


Properties

Property Type Description
Color3.r Number The red value
Color3.g Number The green value
Color3.b Number The blue value

Useful Code

Color3 values only range from 0 to 1. Most people prefer to use a system with a range of 255 instead of a range of one. Here is a useful piece of code:

function Color(r, g, b)
	return Color3.new(r/255, g/255, b/255)
end

Converting BrickColor in to Color3

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

BrickColor