@use 'sass:color';
@use 'sass:string';
@use 'sass:meta';

$darken-multiplier: -1 !default;
$lighten-multiplier: 1 !default;

// Invert darkened and lightened colors
@function darken($color, $amount) {
  @return color.adjust(
    $color,
    $lightness: $amount * $darken-multiplier,
    $space: hsl
  );
}

@function lighten($color, $amount) {
  @return color.adjust(
    $color,
    $lightness: $amount * $lighten-multiplier,
    $space: hsl
  );
}

@function hex-color($color) {
  @if meta.type-of($color) == 'color' {
    $color: string.slice(color.ie-hex-str($color), 4);
  }

  @return '%23' + string.unquote($color);
}
