color-luminance
Functions for calculating the relative luminance of a RGB color.
Since this is just a weighted sum, you can pass components in the range
0-255 or 0-1.
var luminance = require('color-luminance');
var Y = luminance(255, 25, 125);
coefficients
The exported function uses the Rec. 601 standard for coefficients (used in most digital video formats).
More details here.
You can instead use the more explicit functions like so, depending on your needs:
var luminance = require('color-luminance');
var y1 = luminance.rec709(r, g, b);
var y2 = luminance.rec601(r, g, b);