lighten method

Color lighten([
  1. double amount = 0.06
])

Lighten the color by adding the given amount to lightness.

Implementation

Color lighten([double amount = 0.06]) {
  if (_isWhiteOrBlack) {
    final v = (red + amount * 255).round().clamp(0, 255);
    return Color.fromARGB(alpha, v, v, v);
  }

  final hsl = HSLColor.fromColor(this);
  return hsl
      .withLightness(
        (hsl.lightness + amount).clamp(0.0, 1.0),
      )
      .toColor();
}