chromatic-luminance
v1.0.1
Published
Lightweight (no dependencies) and fast color brightness detector built with Flow Types.
Downloads
15
Maintainers
Readme
chromatic-luminance
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