Color

Associated namespace: sm.color

A userdata object representing a color.

Values:

Functions:

Operations:

OperationDescription
Color + ColorReturns the sum of two colors, adding each component.
Color / ColorReturns the quotient of two colors, dividing each component.
Color / numberReturns the quotient of a color and a scalar.
Color == ColorChecks if two colors are equal.
Color * ColorReturns the product of two colors, multiplying each component.
Color * numberReturns the product of a color and a scalar.
Color - ColorReturns the difference of two colors, subtracting each component.
tostring(Color)Returns the color as a string.

a number

Get:

Returns the alpha value of a color.

Set:

Sets the alpha value of a color.


b number

Get:

Returns the blue value of a color.

Set:

Sets the blue value of a color.


g number

Get:

Returns the green value of a color.

Set:

Sets the green value of a color.


r number

Get:

Returns the red value of a color.

Set:

Sets the red value of a color.


getHexStr(color)

Get the hex representation of the color.

Parameters:

TypeNameDescription
ColorcolorThe color object.

Returns:

TypeDescription
stringHex string.