[![Greenkeeper badge](https://badges.greenkeeper.io/tmcw/relative-luminance.svg)](https://greenkeeper.io/)
[![CircleCI](https://circleci.com/gh/tmcw/relative-luminance/tree/master.svg?style=svg)](https://circleci.com/gh/tmcw/relative-luminance/tree/master)

## relative-luminance

    npm install relative-luminance

Calculate the [relative luminance](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef) 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:

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

### API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

##### Table of Contents

-   [relativeLuminance](#relativeluminance)
    -   [Parameters](#parameters)
    -   [Examples](#examples)

#### 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

-   `rgb` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>** 3-element array of a color

##### Examples

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

Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** luminance, between 0 and 1
