# HSL2RGB

Arithmetics
5.1 OC
int
int Val 24 bit HSL value
Converts a 24 bit HSL value into the better known 32 bit RGB format.
The 24 bit HSL value can be created using RGB(hue, saturation, lightness).
Since there is no floating point data type in Clonk, these values may contain slight rounding errors (usually not greater than +1 to +1).
#appendto Clonk

func Initialize() { AddEffect("VariateHue",this,200,1,this); return _inherited(); }

func FxVariateHueTimer() { var hsl = RGB2HSL(GetColor()); var hsla_array = SplitRGBaValue(hsl); hsla_array[0] += 2; if(hsla_array[0] > 255) hue = 0; var rgb = HSL2RGB(RGB(hsla_array[0],hsla_array[1],hsla_array[2])); SetColor(rgb); }
Creates an effect which will colorize every clonk in the game, running through the colors of the rainbow.
To test this effects, best copy this function into a script contained in a scenario local System.ocg group.
The hue value is deliberately increased by 2 in this sample, else rounding errors might cause nothing to happen.
RGB2HSL
SetRGBaValue
RGB
Tyron
2004-09