CLASSES
TagsA - Z

Color3

Objects

Description

class Color3

Basic color defined by Red Green Blue.

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 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 with the Color3 current values.

getClassName() → string

Returns the string "Color3".

getHashCode() → number

Returns the Color3 hash code.

toArray(array, Float32Array, 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 number[] or Float32Array An array of rgb values
optional index number The given index

toColor4(alpha) → Color4

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

Parameters

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

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 The color to substract

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 The color to substract
result Color3 The resulting color

equals(otherColor) → boolean

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

Parameters

Name Type Description
otherColor Color3 The color to substract

equalsFloats(r, g, b) → boolean

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

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

Multiplies in place each rgb value by scale.

Returns the updated Color3.

Parameters

Name Type Description
scale number The scaling factor

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 The scaling factor
result Color3 The resulting color

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 The color to substract

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 The color to substract
result Color3 The resulting color

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 The color to substract

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 The color to substract
result Color3 The resulting color

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 color to copy from

copyFromFloats(r, g, b) → Color3

Updates the Color3 rgb values from the passed floats.

Returns the Color3.

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)

set(r, g, b) → Color3

Updates the Color3 rgb values from the passed floats.

Returns the Color3.

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

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> An array of rgb values
optional offset number

static FromInts(r, g, b) → Color3

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

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

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

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

static Random() → Color3