// --- Color --- //

// Color Variations Function:

// Description:
// Provide a color and step to get a lighter or darker color variation.
// If step provided is bigger than the step variation limit the lighter or darker color available will be returned.

// Usage:
// $c-primary-light: color-variation($c-primary, 1) -> 1 step lighter
// $c-primary-lighter: color-variation($c-primary, 2) -> 2 steps lighter
// $c-primary-dark: color-variation($c-primary, -2) -> 2 steps darker
// $c-primary-darkest: color-variation($c-primary, -4) -> 4 steps darker

$color-lighten-steps: 25, 50, 75, 90, 95 !default;
$color-darken-steps: 20, 35, 55, 75 !default;

@function color-variation($color, $step: 0) {
  $positive-steps: length($color-lighten-steps);
  $negative-steps: length($color-darken-steps);

  $variation: $color;

  @if ($step > $positive-steps) {
    $variation: mix(white, $color, nth($color-lighten-steps, $positive-steps));
  } @else if ($step < -$negative-steps) {
    $variation: mix(black, $color, nth($color-darken-steps, $negative-steps));
  } @else if ($step < 0) {
    $variation: mix(black, $color, nth($color-darken-steps, -$step));
  } @else if ($step > 0) {
    $variation: mix(white, $color, nth($color-lighten-steps, $step));
  }

  @return $variation;
}
