Class used to hold a RGB color

Hierarchy

  • Color3

Constructors

  • 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

b: number

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

g: number

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

r: number

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

Accessors

  • get BlackReadOnly(): DeepImmutableObject<Color3>
  • Gets a Color3 value containing a black color that must not be updated

    Returns DeepImmutableObject<Color3>

Methods

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

    Returns

    the new Color3

    Parameters

    • otherColor: DeepImmutableObject<Color3>

      defines the second operand

    Returns Color3

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

    Returns

    the unmodified current Color3

    Parameters

    • otherColor: DeepImmutableObject<Color3>

      defines the second operand

    • result: Color3

      defines Color3 object to store the result into

    Returns Color3

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

    Returns

    the new array

    Returns number[]

  • Clamps the rgb values by the min and max values and stores the result into "result"

    Returns

    the original Color3

    Parameters

    • min: undefined | number

      defines minimum clamping value (default is 0)

    • max: undefined | number

      defines maximum clamping value (default is 1)

    • result: Color3

      defines color to store the result into

    Returns Color3

  • Copy the current object

    Returns

    a new Color3 copied the current one

    Returns Color3

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

    Returns

    the updated Color3 object

    Parameters

    • source: DeepImmutableObject<Color3>

      defines the source Color3 object

    Returns Color3

  • Updates the Color3 rgb values from the given floats

    Returns

    the current Color3 object

    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

  • Determines equality between Color3 objects

    Returns

    true if the rgb values are equal to the given ones

    Parameters

    • otherColor: DeepImmutableObject<Color3>

      defines the second operand

    Returns boolean

  • Determines equality between the current Color3 object and a set of r,b,g values

    Returns

    true if the rgb values are equal to the given ones

    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

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

    Returns

    the current Color3 object

    Parameters

    • array: DeepImmutableObject<ArrayLike<number>>

      defines the source array

    • Optional offset: number

      defines an offset in the source array

    Returns Color3

  • Returns the string "Color3"

    Returns

    "Color3"

    Returns string

  • Compute the Color3 hash code

    Returns

    an unique number that can be used to hash Color3 objects

    Returns number

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

    Returns

    the new Color3 object

    Parameters

    • otherColor: DeepImmutableObject<Color3>

      defines the second operand

    Returns Color3

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

    Returns

    the current Color3

    Parameters

    • otherColor: DeepImmutableObject<Color3>

      defines the second operand

    • result: Color3

      defines the Color3 object where to store the result

    Returns Color3

  • Creates a new Color3 with the current Color3 values multiplied by scale

    Returns

    a new Color3 object

    Parameters

    • scale: number

      defines the scaling factor to apply

    Returns Color3

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

    Returns

    the unmodified current Color3

    Parameters

    • scale: number

      defines the scale factor

    • result: Color3

      defines color to store the result into

    Returns Color3

  • Multiplies the Color3 values by the float "scale"

    Returns

    the current updated Color3

    Parameters

    • scale: number

      defines the scaling factor to apply

    Returns Color3

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

    Returns

    the unmodified current Color3

    Parameters

    • scale: number

      defines the scaling factor

    • result: Color3

      defines the Color3 object where to store the result

    Returns Color3

  • Updates the Color3 rgb values from the given floats

    Returns

    the current Color3 object

    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

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

    Returns

    the new Color3

    Parameters

    • otherColor: DeepImmutableObject<Color3>

      defines the second operand

    Returns Color3

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

    Returns

    the unmodified current Color3

    Parameters

    • otherColor: DeepImmutableObject<Color3>

      defines the second operand

    • result: Color3

      defines Color3 object to store the result into

    Returns Color3

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

    Returns

    the current Color3 object

    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

  • Returns a new Color4 object from the current Color3 and the given alpha

    Returns

    a new Color4 object

    Parameters

    • Optional alpha: number

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

    Returns Color4

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

    Returns

    a new Color3 object

    Parameters

    • Optional exact: boolean

      defines if the conversion will be done in an exact way which is slower but more accurate (default is false)

    Returns Color3

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

    Returns

    the unmodified Color3

    Parameters

    • convertedColor: Color3

      defines the Color3 object where to store the gamma space version

    • Optional exact: boolean

      defines if the conversion will be done in an exact way which is slower but more accurate (default is false)

    Returns Color3

  • Converts current color in rgb space to HSV values

    Returns

    a new color3 representing the HSV values

    Returns Color3

  • Converts current color in rgb space to HSV values

    Parameters

    • result: Color3

      defines the Color3 where to store the HSV values

    Returns void

  • Compute the Color3 hexadecimal code as a string

    Returns

    a string containing the hexadecimal representation of the Color3 object

    Returns string

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

    Returns

    a new Color3 object

    Parameters

    • Optional exact: boolean

      defines if the conversion will be done in an exact way which is slower but more accurate (default is false)

    Returns Color3

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

    Returns

    the unmodified Color3

    Parameters

    • convertedColor: Color3

      defines the Color3 object where to store the linear space version

    • Optional exact: boolean

      defines if the conversion will be done in an exact way which is slower but more accurate (default is false)

    Returns Color3

  • Returns the luminance value

    Returns

    a float value

    Returns number

  • Creates a string with the Color3 current values

    Returns

    the string representation of the Color3 object

    Returns string

  • Returns a Color3 value containing a black color

    Returns

    a new Color3 object

    Returns Color3

  • Returns a Color3 value containing a blue color

    Returns

    a new Color3 object

    Returns Color3

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

    Returns

    a new Color3 object

    Parameters

    • array: DeepImmutableObject<ArrayLike<number>>

      defines the source array

    • Optional offset: number

      defines an offset in the source array

    Returns Color3

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

    Parameters

    • array: DeepImmutableObject<ArrayLike<number>>

      defines the source array to read from

    • offset: undefined | number

      defines the offset in the source array

    • result: Color3

      defines the target Color3 object

    Returns void

  • Converts Hue, saturation and value to a new Color3 (RGB)

    Returns

    a new Color3 object

    Parameters

    • hue: number

      defines the hue (value between 0 and 360)

    • saturation: number

      defines the saturation (value between 0 and 1)

    • value: number

      defines the value (value between 0 and 1)

    Returns Color3

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

    Returns

    a new Color3 object

    Parameters

    • hex: string

      defines a string containing valid hexadecimal values

    Returns Color3

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

    Returns

    a new Color3 object

    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

  • Returns a Color3 value containing a gray color

    Returns

    a new Color3 object

    Returns Color3

  • Returns a Color3 value containing a green color

    Returns

    a new Color3 object

    Returns Color3

  • Converts Hue, saturation and value to a Color3 (RGB)

    Parameters

    • hue: number

      defines the hue (value between 0 and 360)

    • saturation: number

      defines the saturation (value between 0 and 1)

    • value: number

      defines the value (value between 0 and 1)

    • result: Color3

      defines the Color3 where to store the RGB values

    Returns void

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

    Returns

    the new Color3

    Parameters

    • value1: DeepImmutableObject<Color3>

      defines the first control point

    • tangent1: DeepImmutableObject<Color3>

      defines the first tangent Color3

    • value2: DeepImmutableObject<Color3>

      defines the second control point

    • tangent2: DeepImmutableObject<Color3>

      defines the second tangent Color3

    • amount: number

      defines the amount on the interpolation spline (between 0 and 1)

    Returns Color3

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

    Returns

    1st derivative

    Parameters

    • value1: DeepImmutableObject<Color3>

      defines the first control point

    • tangent1: DeepImmutableObject<Color3>

      defines the first tangent

    • value2: DeepImmutableObject<Color3>

      defines the second control point

    • tangent2: DeepImmutableObject<Color3>

      defines the second tangent

    • time: number

      define where the derivative must be done

    Returns Color3

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

    Parameters

    • value1: DeepImmutableObject<Color3>

      defines the first control point

    • tangent1: DeepImmutableObject<Color3>

      defines the first tangent

    • value2: DeepImmutableObject<Color3>

      defines the second control point

    • tangent2: DeepImmutableObject<Color3>

      defines the second tangent

    • time: number

      define where the derivative must be done

    • result: Color3

      define where to store the derivative

    Returns void

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

    Returns

    a new Color3 object

    Parameters

    • start: DeepImmutableObject<Color3>

      defines the start Color3 value

    • end: DeepImmutableObject<Color3>

      defines the end Color3 value

    • amount: number

      defines the gradient value between start and end

    Returns Color3

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

    Parameters

    • left: DeepImmutableObject<Color3>

      defines the start value

    • right: DeepImmutableObject<Color3>

      defines the end value

    • amount: number

      defines the gradient factor

    • result: Color3

      defines the Color3 object where to store the result

    Returns void

  • Returns a Color3 value containing a magenta color

    Returns

    a new Color3 object

    Returns Color3

  • Returns a Color3 value containing a purple color

    Returns

    a new Color3 object

    Returns Color3

  • Returns a Color3 value containing a random color

    Returns

    a new Color3 object

    Returns Color3

  • Returns a Color3 value containing a red color

    Returns

    a new Color3 object

    Returns Color3

  • Returns a Color3 value containing a teal color

    Returns

    a new Color3 object

    Returns Color3

  • Returns a Color3 value containing a white color

    Returns

    a new Color3 object

    Returns Color3

  • Returns a Color3 value containing a yellow color

    Returns

    a new Color3 object

    Returns Color3

Generated using TypeDoc