color-is-dark
v1.0.1
Published
Returns whether the given rgb color array has a YIQ brightness value of less than 128 (50% brightness).
Downloads
20
Maintainers
Readme
color-is-dark
Returns whether the given rgb color array has a YIQ brightness value of less than 128 (50% brightness).
For more context see this article: Calculating Color Contrast.
Usage
import { colorIsDark } from 'color-is-dark';
colorIsDark([255, 239, 213]); // returns false
Optionally, pass in a brightness threshold in the range 0-255
. colorIsDark
will return true
if the color is less bright.
The default threshold is 128
.
colorIsDark(colorRgb, 85);