Skip to main content

Color

Associated namespace: sm.color

A userdata object representing a color.

Values:
  • r [ number ]

    • Get: The red value of the color (0.0 - 1.0).
    • Set: Sets the red value of the color (0.0 - 1.0).
  • g [ number ]

    • Get: The green value of the color (0.0 - 1.0).
    • Set: Sets the green value of the color (0.0 - 1.0).
  • b [ number ]

    • Get: The blue value of the color (0.0 - 1.0).
    • Set: Sets the blue value of the color (0.0 - 1.0).
  • a [ number ]

    • Get: The alpha value of the color (0.0 - 1.0).
    • Set: Sets the alpha value of the color (0.0 - 1.0).
Operations:
OperationDescription
Color == ColorChecks if two colors are equal.
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 * 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.

Functions

getHexStr

color:getHexStr()

Returns the hex representation of the color.

Arguments:
Returns:
  • [ string ]: The color's hex string.