brighten method

Color brighten([
  1. int amount = 10
])

Brightens the color with the given integer percentage amount. Defaults to 10%.

Implementation

Color brighten([int amount = 10]) {
  if (amount <= 0) return this;
  if (amount > 100) return Colors.white;
  final Color color = Color.fromARGB(
    alpha,
    math.max(0, math.min(255, red - (255 * -(amount / 100)).round())),
    math.max(0, math.min(255, green - (255 * -(amount / 100)).round())),
    math.max(0, math.min(255, blue - (255 * -(amount / 100)).round())),
  );
  return color;
}