lighter method

Color lighter([
  1. double amount = .1
])

Returns a lighter version of this color by moving closer to white.

amount must be between 0.0 (no change) and 1.0 (full white).

Implementation

Color lighter([double amount = .1]) {
  assert(amount >= 0.0 && amount <= 1.0);

  final r =
      ((this.r * 255.0).round() + ((255 - (this.r * 255.0).round()) * amount))
          .round()
          .clamp(0, 255);
  final g =
      ((this.g * 255.0).round() + ((255 - (this.g * 255.0).round()) * amount))
          .round()
          .clamp(0, 255);
  final b =
      ((this.b * 255.0).round() + ((255 - (this.b * 255.0).round()) * amount))
          .round()
          .clamp(0, 255);

  return Color.fromARGB((a * 255.0).round().clamp(0, 255), r, g, b);
}