Color3

From Legacy Roblox Wiki
Revision as of 09:41, 10 July 2011 by >Flurite
Jump to navigationJump to search

A real-valued RGB color tuple, with elements ranging from [0,1].

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:

Example
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!

Example
gui = game.Players.Player.PlayerGui.StarterGui.Gui --this is just an example..

gui.BackgroundColor3 = BrickColor.new('Really red').Color --see how I set-up a BrickColor value then simply add the 'Color' property to the end?


See Also

BrickColor