ratioOfYs

fun ratioOfYs(y1: Double, y2: Double): Double

Contrast ratio is a measure of legibility, its used to compare the lightness of two colors. This method is used commonly in industry due to its use by WCAG.

To compare lightness, the colors are expressed in the XYZ color space, where Y is lightness, also known as relative luminance.

The equation is ratio = lighter Y + 5 / darker Y + 5.

Return

Contrast ratio of two colors.

Parameters

y1

Y in XYZ, relative luminance.

y2

Y in XYZ, relative luminance.