Color.RGBtoHSV()

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

Converts an RGB color value to HSV (hue, saturation and value).
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 v 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 v. If not provided a new object will be created.

Returns
object -

An object with the hue, saturation and value set in the h, s and v properties.

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

Please login to continue.