@akashshyam/color-utilities
Version:
A handy, tiny utility library compatible with typescript. We offer color conversions, color validation, constrast comparison etc
9 lines (8 loc) • 436 B
TypeScript
import { ColorFormat } from './colorConversion';
/**
* Calculates the contrast against black or white
* @param color a color string of one of the supported formats(hex, rgb and hsl)
* @param colorFormat the format in which the color is provided(hex, rgb or hsl)
* @returns either 'black' or 'white' after calculating the contrast
*/
export declare function getContrast(color: string, colorFormat?: ColorFormat): "black" | "white";