JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 93236
  • Score
    100M100P100Q229667F
  • License BSD-2-Clause

calculate relative luminance

Package Exports

  • relative-luminance

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (relative-luminance) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Greenkeeper badge CircleCI

relative-luminance

npm install relative-luminance

Calculate the relative luminance of an RGB triplet color.

Note that as of 1.0.0, this module doesn't directly export a function if you're using CommonJS: use the default export, like:

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

API

Table of Contents

relativeLuminance

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

Parameters
Examples
var luminance = require('relative-luminance');
var black_lum = luminance([0, 0, 0]); // 0

Returns number luminance, between 0 and 1