Colors
colorIsDark

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

Syntax

import { colorIsDark } from '@opentf/std';
 
colorIsDark(input: any): boolean

Returns true if the luminance is less than 0.5.

Examples

colorIsDark('black'); //=> true
colorIsDark('white'); //=> false
colorIsDark('navy'); //=> true

Try