Color3

Color3

Overview

Description

The Color3 class represents colors in RGB (Red, Green, Blue) format with numeric values between 0 and 255. It is commonly used to define colors for various objects or user interface elements in many applications.

Properties

R

number Represents the red component of the color. The value lies in the range [0, 255].

Code Samples

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

G

number Represents the green component of the color. The value lies in the range [0, 255].

Code Samples

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

B

number Represents the blue component of the color. The value lies in the range [0, 255].

Code Samples

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

Constructors

new

Creates a new Color3 instance with the specified red, green, and blue values.

Parameters

Parameter
Description

number red

The red component of the color (between 0 and 255).

number green

The green component of the color (between 0 and 255).

number blue

The blue component of the color (between 0 and 255).

Return

Type
Description

Color3

A new color object with the specified red, green, and blue values.

Code Samples

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

fromRGB

Creates a new Color3 instance using RGB values scaled from the range 0 to 255.

Parameters

Parameter
Description

number red

The red component of the color (between 0 and 255).

number green

The green component of the color (between 0 and 255).

number blue

The blue component of the color (between 0 and 255).

Return

Type
Description

Color3

A new color object with the specified red, green, and blue values, scaled to the range [0, 255].

Code Samples

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

Methods

Last updated