For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

fromRGB

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

Parameters

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

Color3

The created Color3.

Code Samples

local RGB = Color3.fromRGB(255, 10, 50)
print(RGB.R, RGB.G, RGB.B)

new

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

Parameters

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

Color3

The created Color3.

Code Samples

Properties

B

number

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

G

number

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

R

number

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

Methods

Events

Last updated