Color.createColor()

<static> createColor(r, g, b, a, h, s, l, v) → {object}

A utility function to create a lightweight 'color' object with the default components.
Any components that are not specified will default to zero.

This is useful when you want to use a shared color object for the getPixel and getPixelAt methods.

Parameters
Name Type Argument Default Description
r number <optional>
0

The red color component, in the range 0 - 255.

g number <optional>
0

The green color component, in the range 0 - 255.

b number <optional>
0

The blue color component, in the range 0 - 255.

a number <optional>
1

The alpha color component, in the range 0 - 1.

h number <optional>
0

The hue, in the range 0 - 1.

s number <optional>
0

The saturation, in the range 0 - 1.

l number <optional>
0

The lightness, in the range 0 - 1.

v number <optional>
0

The value, in the range 0 - 1.

Returns
object -

The resulting object with r, g, b, a properties and h, s, l and v.

Author:
  • Matt DesLauriers (@mattdesl)
Source code: utils/Color.js (Line 438)
doc_phaser
2017-02-14 10:41:55
Comments
Leave a Comment

Please login to continue.