blackorwhite

0.0.2 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i blackorwhite

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • melvyn