Color3

Color3 is a datatype used for working with colors. Each component (red, green, blue) is stored as a floating-point value between 0 and 1, where 0 represents no intensity and 1 represents full intensity.

Properties

r

number Read-only

The red component of the color (0-1)

g

number Read-only

The green component of the color (0-1)

b

number Read-only

The blue component of the color (0-1)

Methods

fromRGB(r: number, g: number, b: number)

Color3

Creates a Color3 from RGB values in the range 0-255

Parameters:

  • r number - Red component (0-255)
  • g number - Green component (0-255)
  • b number - Blue component (0-255)
local orange = Color3.fromRGB(255, 165, 0)

fromHSV(h: number, s: number, v: number)

Color3

Creates a Color3 from HSV (Hue, Saturation, Value) color space

Parameters:

  • h number - Hue (0-1)
  • s number - Saturation (0-1)
  • v number - Value/Brightness (0-1)
-- Create a bright green
local green = Color3.fromHSV(0.333, 1, 1)

Lerp(other: Color3, alpha: number)

Color3

Returns a Color3 linearly interpolated between this color and the target color

Parameters:

  • other Color3 - The target color to interpolate towards
  • alpha number - The interpolation factor (0-1)
local red = Color3.new(1, 0, 0)
local blue = Color3.new(0, 0, 1)
local purple = red:Lerp(blue, 0.5)