Function __global->rgb_to_hsl
Definitions
sources/themes.php
- Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space.Inspired by https://stackoverflow.com/a/9493060/362006 .Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and l in the set [0, 1].
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $red | integer | No | No | required parameter | N/A | N/A | Red colour (0-255) |
| $green | integer | No | No | required parameter | N/A | N/A | Green colour (0-255) |
| $blue | integer | No | No | required parameter | N/A | N/A | Blue colour (0-255) |
Returns
- Triplet of components: H, S, L (0.0-1.0)
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space.Inspired by https://stackoverflow.com/a/9493060/362006 .Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and l in the set [0, 1].
*
* @param integer $red Red colour (0-255)
* @param integer $green Green colour (0-255)
* @param integer $blue Blue colour (0-255)
* @return array Triplet of components: H, S, L (0.0-1.0)
*/
function rgb_to_hsl(int $red, int $green, int $blue) : array
* Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space.Inspired by https://stackoverflow.com/a/9493060/362006 .Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and l in the set [0, 1].
*
* @param integer $red Red colour (0-255)
* @param integer $green Green colour (0-255)
* @param integer $blue Blue colour (0-255)
* @return array Triplet of components: H, S, L (0.0-1.0)
*/
function rgb_to_hsl(int $red, int $green, int $blue) : array

