YIQ
Returns light when a color is dark and dark when a color is light. 🎨
Installing
yarn add yiq # If you're using NPM: # npm install yiq --save
Basic Usage
Just call the yiq
function after importing it:
; console.logyiq'#fff'; // #000console.logyiq'#000'; // #fff
API
yiq
yiq
— Returns a light color when a color is dark and a dark color when a color is light.
Description
;
The second argument (options) can be used to define the colors that the function will return:
yiq'#fff', ; // #333
It can also be used to define the threshold YIQ value at which the function switches between light and dark:
yiq'#36d386', ; // #fff
The default options are:
options.colors.light
:#fff
;options.colors.dark
:#000
;options.threshold
:128
.
Authors and License
lffg and contributors.
MIT License, see the included MIT file.