Color

Associated namespace: sm.color

A userdata object representing a color.

Values:

Functions:

Operations:

OperationReturn typeDescription
Color + ColorColorReturns the sum of two colors, adding each component.
Color / ColorColorReturns the quotient of two colors, dividing each component.
Color / numberColorReturns the quotient of a color and a scalar.
Color == ColorbooleanChecks if two colors are equal.
Color * ColorColorReturns the product of two colors, multiplying each component.
Color * numberColorReturns the product of a color and a scalar.
Color - ColorColorReturns the difference of two colors, subtracting each component.
tostring(Color)stringReturns 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.


getGuiColorStr(color)

Get the json gui color representation of the color.

Parameters:

TypeNameDescription
ColorcolorThe color object.

Returns:

TypeDescription
stringJson gui color string.

getHexStr(color)

Get the hex representation of the color.

Parameters:

TypeNameDescription
ColorcolorThe color object.

Returns:

TypeDescription
stringHex string.

getUintRgba(color)

Get the uint rgba representation of the color.

Parameters:

TypeNameDescription
ColorcolorThe color object.

Returns:

TypeDescription
integercolor value.