sm.color.new

Creates a new color object from another color object.

Kind: Function

Environments: Game, Terrain

Game

Game overload 1

sm.color.new( color )

Open the full Game reference

Parameters:

Name Type Description
color Color The color to copy.

Returns:

Type Description
Color The created color.

Game overload 2

sm.color.new( r, g, b, a )

Open the full Game reference

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

Parameters:

Name Type Description
r number The red value.
g number The green value.
b number The blue value.
a (optional) number The alpha value. Defaults to 1.0. (Optional)

Returns:

Type Description
Color The created color.

Game overload 3

sm.color.new( hexStr )

Open the full Game reference

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

Parameters:

Name Type Description
hexStr string The hex string.

Returns:

Type Description
Color The created color.

Game overload 4

sm.color.new( hexInt )

Open the full Game reference

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

Parameters:

Name Type Description
hexInt integer The hex value.

Returns:

Type Description
Color The created color.

Terrain

Terrain overload 1

sm.color.new( color )

Open the full Terrain reference

Parameters:

Name Type Description
color Color The color to copy.

Returns:

Type Description
Color The created color.

Terrain overload 2

sm.color.new( r, g, b, a )

Open the full Terrain reference

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

Parameters:

Name Type Description
r number The red value.
g number The green value.
b number The blue value.
a (optional) number The alpha value. Defaults to 1.0. (Optional)

Returns:

Type Description
Color The created color.

Terrain overload 3

sm.color.new( hexStr )

Open the full Terrain reference

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

Parameters:

Name Type Description
hexStr string The hex string.

Returns:

Type Description
Color The created color.

Terrain overload 4

sm.color.new( hexInt )

Open the full Terrain reference

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

Parameters:

Name Type Description
hexInt integer The hex value.

Returns:

Type Description
Color The created color.