💡 Calculates the relative luminance of a color.

Syntax

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

colorLuminance(input: any): number

Returns a value between 0 (darkest black) and 1 (brightest white).

Examples

TypeScript
colorLuminance('white'); //=> 1
colorLuminance('black'); //=> 0
colorLuminance('red'); //=> 0.2126
Last updated on
Edit this page