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.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i blackorwhite

      Weekly Downloads

      1

      Version

      0.0.2

      License

      MIT

      Last publish

      Collaborators

      • melvyn