Socket
Socket
Sign inDemoInstall

get-relative-luminance

Package Overview
Dependencies
2
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    get-relative-luminance

Get relative luminance from a color string.


Version published
Weekly downloads
949
decreased by-11.31%
Maintainers
1
Install size
49.8 kB
Created
Weekly downloads
 

Readme

Source

Get relative luminance

Dependabot Status

get-relative-luminance calculates a CSS color's relative luminance based on this definition from W3C.

It doesn't handle transparency as of yet.

Installation

$ npm install get-relative-luminance

Usage

import getRelativeLuminance from 'get-relative-luminance';

getRelativeLuminance('rgb(255, 255, 255)'); // 1
getRelativeLuminance('white'); // 1
getRelativeLuminance('hsl(0, 0%, 0%)'); // 0

Signature

(color: string, { ignoreTransparency:boolean = false } = {}) => number

Contributing

I appreciate your issues and PRs on Github!

Testing

yarn build && yarn test

Releasing

This project uses np.

  1. Make sure your changes are in master
  2. Run yarn release
  3. Follow the interactive release guide

Keywords

FAQs

Last updated on 08 Nov 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc