Predefined Functions – hsl

Function name: hsl – Create color from real arguments
Synopsis: hsl(hue,lum,sat)


Input data type Output data type
real, real, real color

Description:

The function hsl(<hue>,<saturation>,<luminance>) returns a color which is initialized according to the three parameters passed to the function.

  • The parameter hue can range from 0 to 6. It specifies the color. See the image and description below for more info.
  • The parameter saturation can range from 0 to 1. It specifies the saturation of the color. See the image and description below for more info.
  • The parameter luminance can range from 0 to 1. It specifies the luminance of the color. See the image and description below for more info.

The parameters <hue>, <saturation> and <luminance> should be in the valid range. They will be truncated to the valid range in case they are beyond the valid interval.

The fourth color component, the alpha value of the color, is always set to 1 (i.e. color is totally opaque). If you want to initialize the alpha value as well, please use the hsla-function

The parameters are only used to specify the color. The function takes these values, performs a color space conversion (HSL to RGB format) and creates the RGB values from those parameters. Colors in ChaosPro are always stored in the format RGBA. So this function is rather slow due to the color space conversion.

HSL Color Space

The HSL color space defines colors more naturally: Hue specifies the base color, the other two values then let you specify the saturation of that color and how bright the color should be.

ChaosPro huesat hsl

As you can see in the image at the left, hue specifies the color:

Hue Color
0 red
1 yellow
2 green
3 cyan
4 blue
5 magenta
6 red

After specifying the color using the hue value you can specify the saturation of your color. In the HSL color wheel the saturation specifies the distance from the middle of the wheel. So a saturation value of 0 means “center of the wheel”, i.e. a grey value, whereas a saturation value of 1 means “at the border of the wheel”, i.e. the of the color should be fully saturated.

The third parameter in the HSL color space is the luminance: It lets you specify how “bright” the color should be: 0 means, the bringhtness is 0, and this means, the color is black. 1 means maximum brightness, i.e. the color is white.
If you slowly increase the luminance, then you will see the color changing from black (=0) to a dark version of your color to your color in its full brightness (0.5), then even more brighter and finally it’s white (=1).

The following six luminance sliders show you what happens with colors if you change the luminance:

  Hue 0 1 2 3 4 5
Luminance  
1.0   ChaosPro lum 0 hsl ChaosPro lum 1 hsl ChaosPro lum 2 hsl ChaosPro lum 3 hsl ChaosPro lum 4 hsl ChaosPro lum 5 hsl
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0

hsl