Skip to main content
Version: 1.x

@microsoft/fast-colors > rgbToRelativeLuminance

rgbToRelativeLuminance() function

Get the relative luminance of a color. Adjusts the color to sRGB space, which is necessary for the WCAG contrast spec. The alpha channel of the input is ignored.

Signature:
export declare function rgbToRelativeLuminance(rgb: ColorRGBA64): number;

Parameters

ParameterTypeDescription
rgbColorRGBA64The input color
Returns:

number