ChaosPro Home
Introduction
What's New
Palettes
Using Formulas
Layering in ChaosPro
Rendering
Fractal Parameter Windows
Windows
Menu
3D Transformations
Animations
Formula Compiler
Writing Formulas
Language Reference
Introduction
Basic Syntax
Datatypes
Constants
Variables
Expressions
Operators
Functions
Arithmetic
Conversion
Color
rgb
rgba
hsl
hsla
red
green
blue
alpha
hue
sat
lum
blend
compose
gradient
merge
Trigonometric
Miscellaneous
Control Structures
Compiler Directives
Functions
Interface to ChaosPro
Special Features, Notes...
Compatibility
Fractal Type Reference
Tutorials
Appendix
CHAOSPRO 4.0
Release 4.0
.

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.

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

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

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:

 Hue012345
Luminance 
1.0  
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0