pub static brightness: BrightnessInternalTypeExpand description
Extracts the HSB brightness value from a color or pixel array.
Examples
noStroke();
colorMode(HSB, 255);
let c = color(0, 126, 255);
fill(c);
rect(15, 20, 35, 60);
let value = brightness(c); // Sets 'value' to 255
fill(value);
rect(50, 20, 35, 60);noStroke();
colorMode(HSB, 255);
let c = color('hsb(60, 100%, 50%)');
fill(c);
rect(15, 20, 35, 60);
let value = brightness(c); // A 'value' of 50% is 127.5
fill(value);
rect(50, 20, 35, 60);Parameters
color p5.Color object, color components,
or CSS color