3 /// Programatically determines the contrast ratio between two colors.
5 /// Note that the alpha channel is ignored.
7 /// @link https://goo.gl/54htLV
9 /// @argument {color (hex)} $color-1
11 /// @argument {color (hex)} $color-2
13 /// @return {number (1-21)}
16 /// _contrast-ratio(black, white)
18 /// @require {function} _lightness
22 @function _contrast-ratio($color-1, $color-2) {
23 $-local-lightness-1: _lightness($color-1) + 0.05;
24 $-local-lightness-2: _lightness($color-2) + 0.05;
26 @if $-local-lightness-1 > $-local-lightness-2 {
27 @return $-local-lightness-1 / $-local-lightness-2;
29 @return $-local-lightness-2 / $-local-lightness-1;