Socket
Socket
Sign inDemoInstall

blackorwhite

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    blackorwhite

Get either black or white hex string depending on the background color for maximum contrast.


Version published
Maintainers
1
Created

Readme

Source

blackorwhite

Get either black or white hex codes ('#000000' or '#ffffff'), depending on the background color for its optimal constrast, mostly for the purpose of legibility of the text on the background.

install

npm install --save blackorwhite

usage

import blackOrWhite from 'blackorwhite';

// later in the codes when using

const color = blackOrWhite.get('#9674cd');
console.log(color); // #ffffff

credits

The logic and many parts of the codes are stolen from this StackOverFlow answer/comments.

FAQs

Last updated on 10 Dec 2016

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