Skip to content
Reference > Methods

clrSetRgb(color,red,green,blue)

Definition

String clrSetRgb(String color, Number red, Number green, Number blue)

Description

Sets the red, green or blue 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
red Number Red componenet (0-255) or null to leave default
green Number Green componenet (0-255) or null to leave default
blue Number Blue componenet (0-255) or null to leave default

Examples

String r1 = clrSetRgb(null,255,0,0); // r1 == #ff0000
String r2 = clrSetRgb(null,255,0,0); // r2 == #ff0000
String r3 = clrSetRgb(null,255,128,64); // r3 == #ff8040
String r4 = clrSetRgb(null,255,128,64); // r4 == #ff8040
String r5 = clrSetRgb("#ABC",null,null,null); // r5 == #aabbcc
String r6 = clrSetRgb("#ABC",null,33,null); // r6 == #aa21cc
String r7 = clrSetRgb("#112233",255,null,null); // r7 == #ff2233
String r8 = clrSetRgb("#112233",null,255,null); // r8 == #11ff33
String r9 = clrSetRgb("#112233",null,255,255); // r9 == #11ffff
String r10 = clrSetRgb("#112233",null,null,255); // r10 == #1122ff
Object r11 = clrSetRgb(null,null,null,null); // r11 == null
Object r12 = clrSetRgb(null,null,128,null); // r12 == null
String r13 = clrSetRgb(null,0,128,0); // r13 == #008000