Reverse Text Color Based On Background Color – TEXTColor

Category: Color , Javascript , Text | October 30, 2019
Author:xxasd
Views Total:2,241 views
Official Page:Go to website
Last Update:October 30, 2019
License:MIT

Preview:

Reverse Text Color Based On Background Color – TEXTColor

Description:

TEXTColor is a JavaScript library that selects the proper text color based on the background color to contrast text against backgrounds.

How to use it:

1. Install and import the TEXTColor library.

# NPM
$ npm install textcolor --save
import TEXTColor from 'textcolor-js'

2. Or load the umd version from a CDN.

<script src="https://cdn.jsdelivr.net/npm/textcolor@latest/textcolor.min.js"></script>

3. Find the proper color (for text) from a background color you provide.

let bgColor = '#000000'; 
let textcolor = TEXTColor.findTextColor(bgColor);
console.log(textcolor); // #fff

You Might Be Interested In:


Leave a Reply