# luminance function¶

colourettu.luminance(my_colour)[source]

Determine (relative) luminance of a colour.

Parameters

my_colour (colourettu.Colour) – a colour

Luminance is a measure of how ‘bright’ a colour is. Values are normalized so that the Luminance of White is 1 and the Luminance of Black is 0. That is to say:

>>> colourettu.luminance("#FFF")    # white
0.9999999999999999
>>> colourettu.luminance("#000")    # black
0.0


luminance() can also be called on an already existing colour:

>>> c3.luminance()
0.2641668488934239
>>> colourettu.luminance(c4)
0.08007571268096524


Note

Uses the formula:

$lum = \sqrt{0.299 r^2 + 0.587 g^2 + 0.114 b^2}$