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;

  return Color.fromARGB(
    _intAlpha,
    math.max(0, math.min(255, _intRed - (255 * -(amount / 100)).round())),
    math.max(0, math.min(255, _intGreen - (255 * -(amount / 100)).round())),
    math.max(0, math.min(255, _intBlue - (255 * -(amount / 100)).round())),
  );
}