darken function

Color darken(
  1. Color color,
  2. double percent
)

Darken a color by percent

Implementation

Color darken(Color color, double percent) {
  assert(percent <= 100, 'Darken percent should not be greater than 100');
  final strength = 1 - percent / 100;
  return Color.fromARGB(
    color.alpha,
    (color.red * strength).round(),
    (color.green * strength).round(),
    (color.blue * strength).round(),
  );
}