1.0.1 • Published 12 months ago

color-is-dark v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

npm version Downloads Uses TypeScript

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);
1.0.1

12 months ago

1.0.0

12 months ago