Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Color3

Class used to hold a RGB color

Hierarchy

  • Color3

Index

Constructors

constructor

  • new Color3(r?: number, g?: number, b?: number): Color3
  • Creates a new Color3 object from red, green, blue values, all between 0 and 1

    Parameters

    • Optional r: number

      defines the red component (between 0 and 1, default is 0)

    • Optional g: number

      defines the green component (between 0 and 1, default is 0)

    • Optional b: number

      defines the blue component (between 0 and 1, default is 0)

    Returns Color3

Properties

bSearch playground for b

b: number

Defines the blue component (between 0 and 1, default is 0)

gSearch playground for g

g: number

Defines the green component (between 0 and 1, default is 0)

rSearch playground for r

r: number

Defines the red component (between 0 and 1, default is 0)

Accessors

Static BlackReadOnly

  • Gets a Color3 value containing a black color that must not be updated

    Returns DeepImmutable<Color3>

Methods

addSearch playground for add

  • Creates a new Color3 set with the added values of the current Color3 and of the given one

    Parameters

    Returns Color3

    the new Color3

addToRefSearch playground for addToRef

  • Stores the result of the addition of the current Color3 and given one rgb values into "result"

    Parameters

    Returns Color3

    the unmodified current Color3

asArraySearch playground for asArray

  • asArray(): number[]
  • Returns a new array populated with 3 numeric elements : red, green and blue values

    Returns number[]

    the new array

clampToRefSearch playground for clampToRef

  • clampToRef(min: number | undefined, max: number | undefined, result: Color3): Color3
  • Clamps the rgb values by the min and max values and stores the result into "result"

    Parameters

    • min: number | undefined

      defines minimum clamping value (default is 0)

    • max: number | undefined

      defines maximum clamping value (default is 1)

    • result: Color3

      defines color to store the result into

    Returns Color3

    the original Color3

cloneSearch playground for clone

  • Copy the current object

    Returns Color3

    a new Color3 copied the current one

copyFromSearch playground for copyFrom

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

    Parameters

    Returns Color3

    the updated Color3 object

copyFromFloatsSearch playground for copyFromFloats

  • copyFromFloats(r: number, g: number, b: number): Color3
  • Updates the Color3 rgb values from the given floats

    Parameters

    • r: number

      defines the red component to read from

    • g: number

      defines the green component to read from

    • b: number

      defines the blue component to read from

    Returns Color3

    the current Color3 object

equalsSearch playground for equals

  • Determines equality between Color3 objects

    Parameters

    Returns boolean

    true if the rgb values are equal to the given ones

equalsFloatsSearch playground for equalsFloats

  • equalsFloats(r: number, g: number, b: number): boolean
  • Determines equality between the current Color3 object and a set of r,b,g values

    Parameters

    • r: number

      defines the red component to check

    • g: number

      defines the green component to check

    • b: number

      defines the blue component to check

    Returns boolean

    true if the rgb values are equal to the given ones

fromArraySearch playground for fromArray

  • Update the current color with values stored in an array from the starting index of the given array

    Parameters

    • array: DeepImmutable<ArrayLike<number>>

      defines the source array

    • Optional offset: number

      defines an offset in the source array

    Returns Color3

    the current Color3 object

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Returns the string "Color3"

    Returns string

    "Color3"

getHashCodeSearch playground for getHashCode

  • getHashCode(): number
  • Compute the Color3 hash code

    Returns number

    an unique number that can be used to hash Color3 objects

multiplySearch playground for multiply

  • Multiply each Color3 rgb values by the given Color3 rgb values in a new Color3 object

    Parameters

    Returns Color3

    the new Color3 object

multiplyToRefSearch playground for multiplyToRef

  • Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object "result"

    Parameters

    • otherColor: DeepImmutable<Color3>

      defines the second operand

    • result: Color3

      defines the Color3 object where to store the result

    Returns Color3

    the current Color3

scaleSearch playground for scale

  • scale(scale: number): Color3
  • Multiplies in place each rgb value by scale

    Parameters

    • scale: number

      defines the scaling factor

    Returns Color3

    the updated Color3

scaleAndAddToRefSearch playground for scaleAndAddToRef

  • Scale the current Color3 values by a factor and add the result to a given Color3

    Parameters

    • scale: number

      defines the scale factor

    • result: Color3

      defines color to store the result into

    Returns Color3

    the unmodified current Color3

scaleToRefSearch playground for scaleToRef

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

    Parameters

    • scale: number

      defines the scaling factor

    • result: Color3

      defines the Color3 object where to store the result

    Returns Color3

    the unmodified current Color3

setSearch playground for set

  • set(r: number, g: number, b: number): Color3
  • Updates the Color3 rgb values from the given floats

    Parameters

    • r: number

      defines the red component to read from

    • g: number

      defines the green component to read from

    • b: number

      defines the blue component to read from

    Returns Color3

    the current Color3 object

subtractSearch playground for subtract

  • Returns a new Color3 set with the subtracted values of the given one from the current Color3

    Parameters

    Returns Color3

    the new Color3

subtractToRefSearch playground for subtractToRef

  • Stores the result of the subtraction of given one from the current Color3 rgb values into "result"

    Parameters

    Returns Color3

    the unmodified current Color3

toArraySearch playground for toArray

  • Stores in the given array from the given starting index the red, green, blue values as successive elements

    Parameters

    • array: FloatArray

      defines the array where to store the r,g,b components

    • Optional index: number

      defines an optional index in the target array to define where to start storing values

    Returns Color3

    the current Color3 object

toColor4Search playground for toColor4

  • toColor4(alpha?: number): Color4
  • Returns a new Color4 object from the current Color3 and the given alpha

    Parameters

    • Optional alpha: number

      defines the alpha component on the new Color4 object (default is 1)

    Returns Color4

    a new Color4 object

toGammaSpaceSearch playground for toGammaSpace

  • Computes a new Color3 converted from the current one to gamma space

    Returns Color3

    a new Color3 object

toGammaSpaceToRefSearch playground for toGammaSpaceToRef

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

    Parameters

    • convertedColor: Color3

      defines the Color3 object where to store the gamma space version

    Returns Color3

    the unmodified Color3

toHSVSearch playground for toHSV

  • Converts current color in rgb space to HSV values

    Returns Color3

    a new color3 representing the HSV values

toHSVToRefSearch playground for toHSVToRef

  • toHSVToRef(result: Color3): void
  • Converts current color in rgb space to HSV values

    Parameters

    • result: Color3

      defines the Color3 where to store the HSV values

    Returns void

toHexStringSearch playground for toHexString

  • toHexString(): string
  • Compute the Color3 hexadecimal code as a string

    Returns string

    a string containing the hexadecimal representation of the Color3 object

toLinearSpaceSearch playground for toLinearSpace

  • Computes a new Color3 converted from the current one to linear space

    Returns Color3

    a new Color3 object

toLinearSpaceToRefSearch playground for toLinearSpaceToRef

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

    Parameters

    • convertedColor: Color3

      defines the Color3 object where to store the linear space version

    Returns Color3

    the unmodified Color3

toLuminanceSearch playground for toLuminance

  • toLuminance(): number
  • Returns the luminance value

    Returns number

    a float value

toStringSearch playground for toString

  • toString(): string
  • Creates a string with the Color3 current values

    Returns string

    the string representation of the Color3 object

Static BlackSearch playground for Black

  • Returns a Color3 value containing a black color

    Returns Color3

    a new Color3 object

Static BlueSearch playground for Blue

  • Returns a Color3 value containing a blue color

    Returns Color3

    a new Color3 object

Static FromArraySearch playground for FromArray

  • Creates a new Color3 from the starting index of the given array

    Parameters

    • array: DeepImmutable<ArrayLike<number>>

      defines the source array

    • Optional offset: number

      defines an offset in the source array

    Returns Color3

    a new Color3 object

Static FromArrayToRefSearch playground for FromArrayToRef

  • FromArrayToRef(array: DeepImmutable<ArrayLike<number>>, offset: number | undefined, result: Color3): void
  • Creates a new Color3 from the starting index element of the given array

    Parameters

    • array: DeepImmutable<ArrayLike<number>>

      defines the source array to read from

    • offset: number | undefined

      defines the offset in the source array

    • result: Color3

      defines the target Color3 object

    Returns void

Static FromHexStringSearch playground for FromHexString

  • FromHexString(hex: string): Color3
  • Creates a new Color3 from the string containing valid hexadecimal values

    Parameters

    • hex: string

      defines a string containing valid hexadecimal values

    Returns Color3

    a new Color3 object

Static FromIntsSearch playground for FromInts

  • FromInts(r: number, g: number, b: number): Color3
  • Creates a new Color3 from integer values (< 256)

    Parameters

    • r: number

      defines the red component to read from (value between 0 and 255)

    • g: number

      defines the green component to read from (value between 0 and 255)

    • b: number

      defines the blue component to read from (value between 0 and 255)

    Returns Color3

    a new Color3 object

Static GraySearch playground for Gray

  • Returns a Color3 value containing a gray color

    Returns Color3

    a new Color3 object

Static GreenSearch playground for Green

  • Returns a Color3 value containing a green color

    Returns Color3

    a new Color3 object

Static HSVtoRGBToRefSearch playground for HSVtoRGBToRef

  • HSVtoRGBToRef(hue: number, saturation: number, value: number, result: Color3): void
  • Convert Hue, saturation and value to a Color3 (RGB)

    Parameters

    • hue: number

      defines the hue

    • saturation: number

      defines the saturation

    • value: number

      defines the value

    • result: Color3

      defines the Color3 where to store the RGB values

    Returns void

Static HermiteSearch playground for Hermite

  • Returns a new Color3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2"

    Parameters

    Returns Color3

    the new Color3

Static Hermite1stDerivativeSearch playground for Hermite1stDerivative

  • Returns a new Color3 which is the 1st derivative of the Hermite spline defined by the colors "value1", "value2", "tangent1", "tangent2".

    Parameters

    Returns Color3

    1st derivative

Static Hermite1stDerivativeToRefSearch playground for Hermite1stDerivativeToRef

  • Returns a new Color3 which is the 1st derivative of the Hermite spline defined by the colors "value1", "value2", "tangent1", "tangent2".

    Parameters

    Returns void

Static LerpSearch playground for Lerp

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

    Parameters

    Returns Color3

    a new Color3 object

Static LerpToRefSearch playground for LerpToRef

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

    Parameters

    Returns void

Static MagentaSearch playground for Magenta

  • Returns a Color3 value containing a magenta color

    Returns Color3

    a new Color3 object

Static PurpleSearch playground for Purple

  • Returns a Color3 value containing a purple color

    Returns Color3

    a new Color3 object

Static RandomSearch playground for Random

  • Returns a Color3 value containing a random color

    Returns Color3

    a new Color3 object

Static RedSearch playground for Red

  • Returns a Color3 value containing a red color

    Returns Color3

    a new Color3 object

Static TealSearch playground for Teal

  • Returns a Color3 value containing a teal color

    Returns Color3

    a new Color3 object

Static WhiteSearch playground for White

  • Returns a Color3 value containing a white color

    Returns Color3

    a new Color3 object

Static YellowSearch playground for Yellow

  • Returns a Color3 value containing a yellow color

    Returns Color3

    a new Color3 object

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method