@function get_letter_spacing($tracking, $font-size) {
    @return $tracking / ($font-size * 16) * 1em;
}

@function check-type-scale-value($scale) {

    // Check $scale against the values in $type-scales.
    @if map-has-key($type-scales, $scale) {
  
      // If the value of $scale is defined in
      // $type-scales, return the value of $scale.
      @return map-get($type-scales, $scale);
  
      // If the value of $scale is not defined in the
      // $type-scales map, check if the value is a number
      // and that the number is a unitless value.
    }
  
    @else if type-of($scale)==number and unitless($scale) {
  
      // If the value of $scale is a unitless number,
      // return the number.
      @return $scale;
  
      // Lastly, should the value passed to $scale be neither
      // found in the $type-scales map nor a unitless number,
      // throw a Sass error to explain the issue.
    }
  
    @else {
  
      // Throw a Sass error if the $scale value is
      // neither found in the $type-scales map nor
      // a unitless number.
      @error "Sorry, `#{$scale}` is not a unitless number value or a pre-defined key in the $type-scales map.";
    }
  
  }

// Color contrast
@function color-yiq($color) {
  $r: red($color);
  $g: green($color);
  $b: blue($color);

  $yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
  @if ($yiq >= $yiq-contrasted-threshold) {
    @return $dark;
  } @else {
    @return $white;
  }
}
