$threshold: 50;

/* FUNCTIONS */

@function background-color($color) {
  @if (lightness($color) > $threshold) {
    @return $dark;
  } @else {
    @return $light;
  }
}

@function text-color($color) {
  @if (lightness($color) > $threshold) {
    @return $dark;
  } @else {
    @return $light;
  }
}

@function hover-color($color) {
  @if (lightness($color) > $threshold) {
    @return darken($color, 10%);
  } @else {
    @return lighten($color, 10%);
  }
}