🌙 Checks if a color is dark based on its relative luminance.

Syntax

TypeScript
import { colorIsDark } from '@opentf/std';

colorIsDark(input: any): boolean

Returns true if the luminance is less than 0.5.

Examples

TypeScript
colorIsDark('black'); //=> true
colorIsDark('white'); //=> false
colorIsDark('navy'); //=> true
Last updated on
Edit this page