Skip to main content
Version: 1.x

@microsoft/fast-colors > contrastRatio

contrastRatio() function

Calculate the contrast ratio between two colors. Uses the formula described by WCAG 2.0.

Signature:
export declare function contrastRatio(a: ColorRGBA64, b: ColorRGBA64): number;

Parameters

ParameterTypeDescription
aColorRGBA64
bColorRGBA64
Returns:

number

Remarks

The alpha channel of the input is ignored