css

@function color-yiq(
  $color,
  $support-black: $neutral-gray-dark,
  $white: $yiq-text-light
) {
  $r: red($color);
  $g: green($color);
  $b: blue($color);

  $yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;

  @if ($yiq >= $yiq-contrasted-threshold) {
    @return $support-black;
  } @else {
    @return $white;
  }
}