/*
 * @copyright   Copyright (C) 2010-2024 Combodo SAS
 * @license     http://opensource.org/licenses/AGPL-3.0
 */

/**
 * Adjust the lightness of $sColor to the absolute $fTargetLightness value.
 * It is different than lighten() / darken() that shift the current lightness by X%
 *
 * @return Modified color value in HSLA format
 */
@function common-adjust-lightness($sColor, $fTargetLightness) {
  $iHue: hue($sColor);
  $fSaturation: saturation($sColor);
  $fLightness: lightness($sColor);
  $fAlpha: alpha($sColor);

  @return hsla($iHue, $fSaturation, $fTargetLightness, $fAlpha);
}

/**
 * Adjust the alpha chanel (opacity) of $sColor to the absolute $fTargetAlpha value.
 * It is different than opacify() / transparentize() that shift the current alpha value by X%
 *
 * @return Modified color value in HSLA format
 */
@function common-adjust-alpha($sColor, $fTargetAlpha) {
  $iHue: hue($sColor);
  $fSaturation: saturation($sColor);
  $fLightness: lightness($sColor);
  $fAlpha: alpha($sColor);

  @return hsla($iHue, $fSaturation, $fLightness, $fTargetAlpha);
}