Skip to main content

Color

Associated namespace: sm.color

A userdata object representing an RGBA color value.

Member Values

r

Color.r (number): The red component value.

g

Color.g (number): The green component value.

b

Color.b (number): The blue component value.

a

Color.a (number): The alpha/transparency value.

Operators

OperatorDescription
Color + ColorReturns the component-wise sum of two colors.
Color - ColorReturns the component-wise difference of two colors.
Color / ColorReturns the component-wise quotient of two colors.
Color / numberReturns the component-wise quotient of a color and a scalar.
Color * ColorReturns the component-wise product of two colors.
Color * numberReturns the component-wise product of a color and a scalar.
Color == ColorChecks if two colors are equal.
tostring(Color)Converts the color to a hex color string.

Member Functions

getHexStr

local hex = color:getHexStr()

Returns the color's value as a hex color string.

Parameters:

  • color (Color): The color.

Returns:

  • hex (string): The hex color string.