Skip to content
Reference > Methods

clrSetHsl(color,hue,saturation,luminance)

Definition

String clrSetHsl(String color, Number hue, Number saturation, Number luminance)

Description

Sets the hue, saturation or luminance of the supplied color. Creates a new color if all three are supplied. Returns the resulting color in rrggbb format, or null if not a valid color.

Parameter Definition

Name Type Description
color String Default Color to update
hue Number Hue componenet (0-65535) or null to leave default, not the number will role, ex: 65536 -> 0, -1 => 65535
saturation Number Saturation componenet (0-65535) or null to leave default
luminance Number Luminance componenet (0-65535) or null to leave default

Examples

String r1 = clrSetHsl(null,255,0,0); // r1 == #000000
String r2 = clrSetHsl(null,255,0,0); // r2 == #000000
String r3 = clrSetHsl(null,255,128,64); // r3 == #7547ff
String r4 = clrSetHsl(null,255,128,64); // r4 == #7547ff
String r5 = clrSetHsl("#ABC",null,null,null); // r5 == #aabbcc
String r6 = clrSetHsl("#ABC",null,33,null); // r6 == #a5bbd2
String r7 = clrSetHsl("#112233",255,null,null); // r7 == #191133
String r8 = clrSetHsl("#112233",null,255,null); // r8 == #002244
String r9 = clrSetHsl("#112233",null,255,255); // r9 == #ffffff
String r10 = clrSetHsl("#112233",null,null,255); // r10 == #ffffff
Object r11 = clrSetHsl(null,null,null,null); // r11 == null
Object r12 = clrSetHsl(null,null,128,null); // r12 == null
String r13 = clrSetHsl(null,0,128,0); // r13 == #000000