@jeact/contrast-color
Version:
Simple function to get the contrast color for a text over some color
10 lines (9 loc) • 338 B
TypeScript
import type { Color } from './types';
/**
* Gets the luminance of a color
* Formula: https://www.w3.org/TR/WCAG20/#relativeluminancedef
* @param color A string representation of a color
* @returns A number indicating the luminance of the color
*/
declare const luminance: (color: Color) => number;
export default luminance;