Color.RGBtoHSL()

<static> RGBtoHSL(r, g, b, out) → {object}

Converts an RGB color value to HSL (hue, saturation and lightness).
Conversion forumla from http://en.wikipedia.org/wiki/HSL_color_space.
Assumes RGB values are contained in the set [0, 255] and returns h, s and l in the set [0, 1].
Based on code by Michael Jackson (https://github.com/mjijackson)

Parameters
Name Type Argument Description
r number

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

g number

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

b number

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

out object <optional>

An object into which 3 properties will be created, h, s and l. If not provided a new object will be created.

Returns
object -

An object with the hue, saturation and lightness values set in the h, s and l properties.

Source code: utils/Color.js (Line 161)
doc_phaser
2017-02-14 10:42:11
Comments
Leave a Comment

Please login to continue.