Lightness, also known as value or tone, is a property (coordinate) placed on a linear scale where:
Some colors are naturally:
and can therefore be projected on the greyscale.
Various color models have an explicit term for this property.
Lightness may be used in colorspace as coordinate. Example with HSL.
In subtractive color (i.e. paints), lightness value changes can be achieved by adding black or white to the color.
Both processes (tint and shade) affect the saturation but the hue remains unchanged.
from a rgb colorspace
$max = max($red, $green, $blue);
$min = min($red, $green, $blue);
$lightness = ($max + $min) / 2;