darken method

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

Darkens the color by a specified percentage.

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

Returns a new Color object that represents the darkened color.

Implementation

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