Color3

Objects

Description

class Color3

Constructor

new Color3(r, g, b)

Creates a new Color3 object from red, green, blue values, all between 0 and 1.

Parameters

Name Type Description
optional r number
optional g number
optional b number

Members

r : number

g : number

b : number

Methods

toString() string

Returns a string with the Color3 current values.

getClassName() string

Returns the string "Color3".

getHashCode() number

Returns the Color3 hash code.

toArray(array, index) Color3

Stores in the passed array from the passed starting index the red, green, blue values as successive elements.

Returns the Color3.

Parameters

Name Type Description
array FloatArray
optional index number

toColor4(alpha) Color4

Returns a new Color4 object from the current Color3 and the passed alpha.

Parameters

Name Type Description
optional alpha number

asArray() number[]

Returns a new array populated with 3 numeric elements : red, green and blue values.

toLuminance() number

Returns the luminance value (float).

multiply(otherColor) Color3

Multiply each Color3 rgb values by the passed Color3 rgb values in a new Color3 object.

Returns this new object.

Parameters

Name Type Description
otherColor Color3

multiplyToRef(otherColor, result) Color3

Multiply the rgb values of the Color3 and the passed Color3 and stores the result in the object "result".

Returns the current Color3.

Parameters

Name Type Description
otherColor Color3
result Color3

equals(otherColor) boolean

Boolean : True if the rgb values are equal to the passed ones.

Parameters

Name Type Description
otherColor Color3

equalsFloats(r, g, b) boolean

Boolean : True if the rgb values are equal to the passed ones.

Parameters

Name Type Description
r number
g number
b number

scale(scale) Color3

Multiplies in place each rgb value by scale.

Returns the updated Color3.

Parameters

Name Type Description
scale number

scaleToRef(scale, result) Color3

Multiplies the rgb values by scale and stores the result into "result".

Returns the unmodified current Color3.

Parameters

Name Type Description
scale number
result Color3

add(otherColor) Color3

Returns a new Color3 set with the added values of the current Color3 and of the passed one.

Parameters

Name Type Description
otherColor Color3

addToRef(otherColor, result) Color3

Stores the result of the addition of the current Color3 and passed one rgb values into "result".

Returns the unmodified current Color3.

Parameters

Name Type Description
otherColor Color3
result Color3

subtract(otherColor) Color3

Returns a new Color3 set with the subtracted values of the passed one from the current Color3 .

Parameters

Name Type Description
otherColor Color3

subtractToRef(otherColor, result) Color3

Stores the result of the subtraction of passed one from the current Color3 rgb values into "result".

Returns the unmodified current Color3.

Parameters

Name Type Description
otherColor Color3
result Color3

clone() Color3

Returns a new Color3 copied the current one.

copyFrom(source) Color3

Copies the rgb values from the source in the current Color3.

Returns the updated Color3.

Parameters

Name Type Description
source Color3

copyFromFloats(r, g, b) Color3

Updates the Color3 rgb values from the passed floats.

Returns the Color3.

Parameters

Name Type Description
r number
g number
b number

set(r, g, b) Color3

Updates the Color3 rgb values from the passed floats.

Returns the Color3.

Parameters

Name Type Description
r number
g number
b number

toHexString() string

Returns the Color3 hexadecimal code as a string.

toLinearSpace() Color3

Returns a new Color3 converted to linear space.

toLinearSpaceToRef(convertedColor) Color3

Converts the Color3 values to linear space and stores the result in "convertedColor".

Returns the unmodified Color3.

Parameters

Name Type Description
convertedColor Color3

toGammaSpace() Color3

Returns a new Color3 converted to gamma space.

toGammaSpaceToRef(convertedColor) Color3

Converts the Color3 values to gamma space and stores the result in "convertedColor".

Returns the unmodified Color3.

Parameters

Name Type Description
convertedColor Color3

static FromHexString(hex) Color3

Creates a new Color3 from the string containing valid hexadecimal values.

Parameters

Name Type Description
hex string

static FromArray(array, offset) Color3

Creates a new Vector3 from the startind index of the passed array.

Parameters

Name Type Description
array ArrayLike<number>
optional offset number

static FromInts(r, g, b) Color3

Creates a new Color3 from integer values ( < 256).

Parameters

Name Type Description
r number
g number
b number

static Lerp(start, end, amount) Color3

Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3.

Parameters

Name Type Description
start Color3
end Color3
amount number

static Red() Color3

static Green() Color3

static Blue() Color3

static Black() Color3

static White() Color3

static Purple() Color3

static Magenta() Color3

static Yellow() Color3

static Gray() Color3

static Teal() Color3

static Random() Color3