sm.color

Associated object type: Color

A color is represented using a red, green, blue and alpha component. Colors are prominently used for blocks and parts that are colored by the Paint Tool.

To create one, use sm.color.new. It is possible to use hex `0xRRGGBBAA` or strings `"RRGGBBAA"`.

Note:

R, G, B, A values range between 0.0–1.0.

Functions:

  • new
  • new
  • new

  • sm.color.new(r, g, b, a=nil)

    Creates a new color object from R, G, B, A.

    Parameters:

    TypeNameDescription
    numberrThe red value.
    numbergThe green value.
    numberbThe blue value.
    numbera=nilThe alpha value. Defaults to 1.0. (Optional)

    Returns:

    TypeDescription
    ColorThe created color.

    sm.color.new(hexStr)

    Creates a new color object from a hex string `"RRGGBBAA"`.

    Parameters:

    TypeNameDescription
    stringhexStrThe hex string.

    Returns:

    TypeDescription
    ColorThe created color.

    sm.color.new(hexInt)

    Creates a new color object from a hex value `0xRRGGBBAA`.

    Parameters:

    TypeNameDescription
    integerhexIntThe hex value.

    Returns:

    TypeDescription
    ColorThe created color.