Skip to content
Reference > Methods

clrGetAlpha(color)

Definition

Integer clrGetAlpha(String color)

Description

Returns an Integer between 0-255 the alpha component of the supplied color. Returns null if supplied color is null or invalid format. Returns 255 if there is no alpha component.

Parameter Definition

Name Type Description
color String Color to inspect in rrggbb format

Examples

1
2
3
4
5
6
7
8
Integer r1 = clrGetAlpha("#AABBCC"); // r1 == 255
Integer r2 = clrGetAlpha("#AABBCCDD"); // r2 == 221
Integer r3 = clrGetAlpha("#AABBCCFF"); // r3 == 255
Integer r4 = clrGetAlpha("#AABBCC00"); // r4 == 0
Integer r5 = clrGetAlpha("#ABC"); // r5 == 255
Integer r6 = clrGetAlpha("#ABCD"); // r6 == 221
Object r7 = clrGetAlpha("invalid"); // r7 == null
Object r8 = clrGetAlpha(null); // r8 == null