CLASSES
TagsA - Z

Color3

Objects

Description

class Color3

Basic color defined by Red Green Blue.

Constructor

new Color3(r, g, b)

Creates a new RGB Color3

Parameters

Name Type Description
optional r number The red value (0<r<1)
optional g number The green value (0<g<1)
optional b number The blue value (0<b<1)

Members

r : number

red value

g : number

green value

b : number

blue value

Methods

toString() string

Returns a string representation of the color

getClassName() string

getHashCode() number

toArray(array, index) Color3

Fills an array from a given index with the color's RGB values

Parameters

Name Type Description
array number[] An array of rgb values
optional index number The given index

toColor4(alpha) Color4

Return a Color4 object

Parameters

Name Type Description
optional alpha number default : 1 The given alpha

asArray() number[]

Returns an array representation of the color

toLuminance() number

Returns the luminance of the color

multiply(otherColor) Color3

Multiplies two Color3 and returns the result

Parameters

Name Type Description
otherColor Color3 The color to substract

multiplyToRef(otherColor, result) Color3

Multiplies two Color3 into an existing Color

Parameters

Name Type Description
otherColor Color3 The color to substract
result Color3 The resulting color

equals(otherColor) boolean

Tests if two Color3 have the same rgb values

Parameters

Name Type Description
otherColor Color3 The color to substract

equalsFloats(r, g, b) boolean

Parameters

Name Type Description
r number The red value (0<r<1)
g number The green value (0<g<1)
b number The blue value (0<b<1)

scale(scale) Color3

Scales a Color3 : multiply red, green and blue values by the given number

Parameters

Name Type Description
scale number The scaling factor

scaleToRef(scale, result) Color3

Scale a Color3 into an existing Color

Parameters

Name Type Description
scale number The scaling factor
result Color3 The resulting color

add(otherColor) Color3

Adds another color and returns the result

Parameters

Name Type Description
otherColor Color3 The color to substract

addToRef(otherColor, result) Color3

Adds another color and store the result in the color given in parameter

Parameters

Name Type Description
otherColor Color3 The color to substract
result Color3 The resulting color

subtract(otherColor) Color3

Substracts another color and returns the result

Parameters

Name Type Description
otherColor Color3 The color to substract

subtractToRef(otherColor, result) Color3

Substracts another color and store the result in the given color

Parameters

Name Type Description
otherColor Color3 The color to substract
result Color3 The resulting color

clone() Color3

Create a clone of a Color3

copyFrom(source) Color3

Copies a Color3

Parameters

Name Type Description
source Color3 color to copy from

copyFromFloats(r, g, b) Color3

Copies a color from numbers

Parameters

Name Type Description
r number The red value (0<r<1)
g number The green value (0<g<1)
b number The blue value (0<b<1)

toHexString() string

toLinearSpace() Color3

toLinearSpaceToRef(convertedColor) Color3

Parameters

Name Type Description
convertedColor Color3

toGammaSpace() Color3

toGammaSpaceToRef(convertedColor) Color3

Parameters

Name Type Description
convertedColor Color3

static FromHexString(hex) Color3

Parameters

Name Type Description
hex string

static FromArray(array, offset) Color3

Creates a new Color3 from an array

Parameters

Name Type Description
array number[] An array of rgb values
optional offset number

static FromInts(r, g, b) Color3

Creates a new Color3 from a set of integers. Values must be between 0 and 255

Parameters

Name Type Description
r number The red value (0<r<1)
g number The green value (0<g<1)
b number The blue value (0<b<1)

static Lerp(start, end, amount) Color3

Linear interpolation of a color

Parameters

Name Type Description
start Color3 interpolation start color
end Color3 interpolation end color
amount number Weighting factor

static Red() Color3

Red color

static Green() Color3

Green color

static Blue() Color3

Blue color

static Black() Color3

Black color

static White() Color3

White color

static Purple() Color3

Purple color

static Magenta() Color3

Magenta color

static Yellow() Color3

Yellow color

static Gray() Color3