Color3

Overview

Color3 combines the three elements of RGB in ratio form to express a color, with each channel ranging from 0 to 1.

Unlike BrickColor, which selects predefined color names, Color3 can be used to directly adjust the desired color with numerical values. It is therefore used to set the color palette of a part or GUI element in detail.

Constructors

new

Combines the input RGB ratios to create and return a new Color3 color object.

Parameters

Parameter
Description

number red

A value representing the Red ratio in the RGB color system. 0 means the intensity of Red is very low, and 1 means the intensity of Red is very high.

number green

A value representing the Green ratio in the RGB color system. 0 means the intensity of Green is very low, and 1 means the intensity of Green is very high.

number blue

A value representing the Blue ratio in the RGB color system. 0 means the intensity of Blue is very low, and 1 means the intensity of Blue is very high.

Return

Type
Description

Color3

The created Color3.

Code Samples

local Color = Color3.new(0.5, 0, 0)

fromRGB

Combines the input RGB values to create and return a new Color3 color object.

Parameters

Parameter
Description

number red

A value representing the Red ratio in the RGB color system, ranging from 0 to 255.

number green

A value representing the Green ratio in the RGB color system, ranging from 0 to 255.

number blue

A value representing the Blue ratio in the RGB color system, ranging from 0 to 255.

Return

Type
Description

Color3

The created Color3.

Code Samples

Properties

R

A value representing the Red ratio of Color3 in the RGB color system. 0 means the intensity of Red is very low, and 1 means the intensity of Red is very high.

Code Samples

G

A value representing the Green ratio of Color3 in the RGB color system. 0 means the intensity of Green is very low, and 1 means the intensity of Green is very high.

Code Samples

B

A value representing the Blue ratio of Color3 in the RGB color system. 0 means the intensity of Blue is very low, and 1 means the intensity of Blue is very high.

Code Samples

Methods

Last updated