darken method
- double amount = .2
Returns a darken variant of this color.
Implementation
Color darken([double amount = .2]) {
assert(amount >= 0 && amount <= 1);
if (amount == 0) {
return this;
}
final hsl = HSLColor.fromColor(this);
final hslLight = hsl.withLightness(
(hsl.lightness - amount).clamp(0.0, 1.0),
);
return hslLight.toColor();
}