lighten method

Color lighten([
  1. int percent = 10
])

Lightens the color by a specified percentage.

The percent parameter specifies the percentage by which the color should be lightened. The value of percent should be between 0 and 100.

Returns a new Color object that represents the lightened color.

Implementation

Color lighten([int percent = 10]) {
  assert(0 <= percent && percent <= 100);
  final p = percent / 100;
  return Color.fromARGB(
    alpha,
    red + ((255 - red) * p).round(),
    green + ((255 - green) * p).round(),
    blue + ((255 - blue) * p).round(),
  );
}