Phaser API Documentation

  Version: 
<static> RGBToHSV(r, g, b, [out])

Description:

Converts an RGB color value to HSV (hue, saturation and value). Conversion formula 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 arguments description
r number

The red color value. A number between 0 and 255.

g number

The green color value. A number between 0 and 255.

b number

The blue color value. A number between 0 and 255.

out Phaser.Display.Color | Phaser.Types.Display.HSVColorObject <optional>

An object to store the color values in. If not given an HSV Color Object will be created.

Returns:
Description:

An object with the properties h, s and v set.

Since: 3.0.0