blackorwhite
v0.0.2
Published
Get either black or white hex string depending on the background color for maximum contrast.
Downloads
6
Readme
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.