Skip to content

rodrigoitj/is-readable-color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Is Readable Color

A npm module that determines if a text color is readable in contrast with a background color

Usage

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)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published