1.0.0 • Published 1 year ago
color-is-dark v1.0.0
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 falseOptionally, 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);