UNPKG

contra-color

Version:

For a given color, find a contrasting color (not optimal).

21 lines (20 loc) 999 B
interface IContraColor { color: string; contrast: number; } /** get a contrasting color for a given color. If `isLinearLuminance` is true, it will use the linear luminance formula. Otherwise, it will use power curve. * Set `contrastDiff` as 0 to find color with maximum contrast. If you pass a number in range (0,20], it will find a color with a the smallest contrast that is greater then `contrastDiff` * @param {string} c * @param {} isLinearLuminance=true * @param {} contrastDiff=0 * @returns IContraColor */ export declare function getContrastingColor(c: string, isLinearLuminance?: boolean, contrastDiff?: number): IContraColor; /** Find contrast of two colors. If you pass `isLinearLuminance`, it will calculate luminance with power curve. * @param {string} c1 * @param {string} c2 * @param {} isLinearLuminance=true * @returns number */ export declare function getContrast(c1: string, c2: string, isLinearLuminance?: boolean): number; export {};