Skip to main content

Color Class

Description:

  Provides methods for creating Color objects.

__call

Type: Metamethod.

Description:

  Creates a new Color object with a Color3 object and alpha value.

Signature:

metamethod __call: function(self: ColorClass, color: Color3, a: number): Color

Parameters:

ParameterTypeDescription
colorColor3The color as a Color3 object.
anumber[optional] The alpha value of the color ranging from 0 to 255.

Returns:

Return TypeDescription
ColorA new Color object.

__call

Type: Metamethod.

Description:

  Creates a new Color object from an ARGB integer value.

Signature:

metamethod __call: function(self: ColorClass, argb?: number): Color

Parameters:

ParameterTypeDescription
argbnumber[optional] The ARGB integer value to create the color from. Default is 0.
For example 0xffffffff (opaque white), 0x88ff0000 (half transparent red)

Returns:

Return TypeDescription
ColorA new Color object.

__call

Type: Metamethod.

Description:

  Creates a new Color object from a RGBA string.

Signature:

metamethod __call: function(self: ColorClass, rgba: string): Color

Parameters:

ParameterTypeDescription
rgbastringThe RGBA string to create the color from, format like "#RRGGBBAA".

Returns:

Return TypeDescription
ColorA new Color object.

__call

Type: Metamethod.

Description:

  Creates a new Color object from RGBA color channel values.

Signature:

metamethod __call: function(self: ColorClass, r: number, g: number, b: number, a: number): Color

Parameters:

ParameterTypeDescription
rnumberThe red channel value (0-255).
gnumberThe green channel value (0-255).
bnumberThe blue channel value (0-255).
anumberThe alpha channel value (0-255).

Returns:

Return TypeDescription
ColorA new Color object.