lighten method

Color lighten(
  1. Node color,
  2. Dimension amount,
  3. [Keyword method]
)

Increase the lightness of a color in the HSL color space by an absolute amount.

Parameters: color: A color object. amount: A percentage 0-100%. method: Optional, set to relative for the adjustment to be relative to the current value. Returns: color Example: lighten(hsl(90, 80%, 50%), 20%) Output: #b3f075 // hsl(90, 80%, 70%)

Implementation

Color lighten(Node color, Dimension amount, [Keyword method]) {
  final hsl = toHSL(color);

  hsl
    ..l += (method?.value == 'relative')
        ? hsl.l * amount.value / 100
        : amount.value / 100
    ..l = clamp(hsl.l);

  return hslaColorSpace(color, hsl);

// 3.9.0 20190711
//  lighten: function (color, amount, method) {
//    var hsl = toHSL(color);
//
//    if (typeof method !== 'undefined' && method.value === 'relative') {
//      hsl.l +=  hsl.l * amount.value / 100;
//    }
//    else {
//      hsl.l += amount.value / 100;
//    }
//    hsl.l = clamp(hsl.l);
//    return hsla(color, hsl);
//  },
}