1.0.1 • Published 6 years ago

chromatic-luminance v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

chromatic-luminance

Build Status Coverage Status code style: prettier jest

Lightweight (no dependencies) and fast color brightness detector based on the w3 documentation for color luminance: https://www.w3.org/TR/WCAG20/#relativeluminancedef. Answers question: dark-background -> use light text OR light-background -> use dark text.

Installation

yard add chromatic-luminance or npm install chromatic-luminance

API

/*
 * Returns True/False if color is considered 'dark' or not by W3 luminance standards
 * @param {color} can be shorthand hex (e.g. '#000'), normal hex (e.g. '#000000') or HTML named colors (e.g. 'black')
 */
default function isDark(color: string): boolean;

Test

yarn test or npm run test

License

MIT