accessiplot.detection.contrast_ratio.calculate_contrast_ratio

accessiplot.detection.contrast_ratio.calculate_contrast_ratio(rgb1, rgb2)[source]

Calculates the contrast ratio given two tuples of normalized rgb values. These values must be in the range of [0,1].

Parameters:
rgb1: tuple

A tuple of 3 values that are [0,1] which represent the normalized RGB values converted from the 8-bit 0-255 representation.

rgb2: tuple

A tuple of 3 values that are [0,1] which represent the normalized RGB values converted from the 8-bit 0-255 representation.

Returns:
contrast_ratio: float

Contrast ratio calculated from the relative luminance of two normalized rgb tuples of values.

References