Name

alpha()

Description

Extracts the alpha value from a color.

Examples

  • size(400,400);
    noStroke();
    color c = color(0, 126, 255, 102);
    fill(c);
    rect(60, 60, 140, 280);
    float value = alpha(c);  // Sets 'value' to 102
    fill(value);
    rect(200, 60, 140, 280);
    
    Image output for example 1

Syntax

  • alpha(rgb)

Parameters

  • rgb(int)any value of the color datatype

Return

  • float