A npm module that determines if a text color is readable in contrast with a background color
To use this function, you can call it like this:
import isReadableColor from "is-readable-color";
const textColor = '#000000'; // Black
const bgColor = '#ffffff'; // White
if (isReadableColor(textColor, bgColor)) {
console.log('The text color is readable.');
} else {
console.log('The text color is not readable.');
}
Also a text size optional parameter is accepted, default is 18
isReadableColor(textColor, bgColor, 12)