Color
Associated namespace: sm.color
A userdata object representing a color.
Values:
Functions:
Operations:
Operation | Description |
---|---|
Color + Color | Returns the sum of two colors, adding each component. |
Color / Color | Returns the quotient of two colors, dividing each component. |
Color / number | Returns the quotient of a color and a scalar. |
Color == Color | Checks if two colors are equal. |
Color * Color | Returns the product of two colors, multiplying each component. |
Color * number | Returns the product of a color and a scalar. |
Color - Color | Returns 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:
Type | Name | Description |
---|---|---|
Color | color | The color object. |
Returns:
Type | Description |
---|---|
string | Hex string. |