Skip to content

ts-web/color-is-dark

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published