Sha256: 347c6eb9fce6286ba8a01e95c5fd06be82c160969a4a12309a741a5b839dfa69

Contents?: true

Size: 740 Bytes

Versions: 27

Compression:

Stored size: 740 Bytes

Contents

@charset "UTF-8";

/// Programatically determines the contrast ratio between two colors.
///
/// Note that the alpha channel is ignored.
///
/// @link https://goo.gl/54htLV
///
/// @argument {color (hex)} $color-1
///
/// @argument {color (hex)} $color-2
///
/// @return {number (1-21)}
///
/// @example scss
///   _contrast-ratio(black, white)
///
/// @require {function} _lightness
///
/// @access private

@function _contrast-ratio($color-1, $color-2) {
  $-local-lightness-1: _lightness($color-1) + 0.05;
  $-local-lightness-2: _lightness($color-2) + 0.05;

  @if $-local-lightness-1 > $-local-lightness-2 {
    @return $-local-lightness-1 / $-local-lightness-2;
  } @else {
    @return $-local-lightness-2 / $-local-lightness-1;
  }
}

Version data entries

27 entries across 27 versions & 5 rubygems

Version Path
baseline-scss-0.5.0 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.4.4 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.4.3 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.4.2 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.4.1 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.4.0 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.3.3 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.3.2 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.3.1 src/vendors/bourbon/utilities/_contrast-ratio.scss
baseline-scss-0.3.0 src/vendors/bourbon/utilities/_contrast-ratio.scss
bourbon-7.3.0 core/bourbon/utilities/_contrast-ratio.scss
bourbon-7.2.0 core/bourbon/utilities/_contrast-ratio.scss
geekspace-3.2.0 _sass/bourbon/bourbon/utilities/_contrast-ratio.scss
geekspace-3.1.2 _sass/bourbon/bourbon/utilities/_contrast-ratio.scss
geekspace-3.1.1 _sass/bourbon/bourbon/utilities/_contrast-ratio.scss
bourbon-7.0.0 core/bourbon/utilities/_contrast-ratio.scss
bourbon-6.0.0 core/bourbon/utilities/_contrast-ratio.scss
bourbon-5.1.0 core/bourbon/utilities/_contrast-ratio.scss
bourbon-5.0.1 core/bourbon/utilities/_contrast-ratio.scss
bourbon-5.0.0 core/bourbon/utilities/_contrast-ratio.scss