Rebol Programming/brightness?

From Wikibooks, open books for an open world
< Rebol Programming
Jump to navigation Jump to search

USAGE:[edit | edit source]

BRIGHTNESS? color 

DESCRIPTION:[edit | edit source]

Returns the monochrome brightness (0.0 to 1.0) for a color value.

BRIGHTNESS? is a function value.

ARGUMENTS[edit | edit source]

  • color -- (Type: tuple)

SOURCE CODE[edit | edit source]

brightness?: func [
    {Returns the monochrome brightness (0.0 to 1.0) for a color value.} 
    color [tuple!]
][
    (0.27 * color/1) + (0.63 * color/2) + (0.1 * color/3) / 255
]