darken method

Color darken([
  1. double amount = 0.15
])

Returns a darker shade of this color.

amount must be between 0.0 and 1.0.

Implementation

Color darken([double amount = 0.15]) {
  assert(amount >= 0 && amount <= 1);
  final hsl = HSLColor.fromColor(this);
  return hsl
      .withLightness((hsl.lightness - amount).clamp(0.0, 1.0))
      .toColor();
}