Author: | xxasd |
---|---|
Views Total: | 2,241 views |
Official Page: | Go to website |
Last Update: | October 30, 2019 |
License: | MIT |
Preview:

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