relative-luminance

calculate relative luminance

npm install relative-luminance
4 downloads in the last month

relative-luminance

npm install relative-luminance

Calculate the relative luminance of an RGB triplet color.

api

luminance(rgb)

Given a 3-element array of R, G, B varying from 0 to 255, return the luminance as a number from 0 to 1.

example

var luminance = require('relative-luminance');

var black_lum = luminance([0, 0, 0]); // 0
npm loves you