shadeColor method

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

Implementation

Color shadeColor(Color color, double percent) {
  int t = percent < 0 ? 0 : 255;
  double p = percent < 0 ? -percent : percent;
  int red = color.red;
  int green = color.green;
  int blue = color.blue;
  int alpha = color.alpha;

  return Color.fromARGB(
    alpha,
    red + ((t - red) * p).toInt(),
    green + ((t - green) * p).toInt(),
    blue + ((t - blue) * p).toInt(),
  );
}