brightness()

Extracts the brightness value from a color.

Examples

example picture for brightness()
1
2
3
4
5
6
7
8
9
def setup():
    py5.no_stroke()
    py5.color_mode(py5.HSB, 255)
    c = py5.color(0, 126, 255)
    py5.fill(c)
    py5.rect(15, 20, 35, 60)
    value = py5.brightness(c)  # sets 'value' to 255
    py5.fill(value)
    py5.rect(50, 20, 35, 60)

Description

Extracts the brightness value from a color.

Underlying Java method: brightness

Syntax

brightness(rgb: int, /) -> float

Parameters

  • rgb: int - any value of the color datatype

Updated on September 11, 2021 16:51:34pm UTC