mix method

Color mix({
  1. required Color input,
  2. int amount = 50,
})

Blends the color with another color a given amount, from 0 - 100, default 50.

Implementation

Color mix({required Color input, int amount = 50}) {
  final int p = (amount / 100).round();
  return Color.fromARGB(
    (input.alpha - alpha) * p + alpha,
    (input.red - red) * p + red,
    (input.green - green) * p + green,
    (input.blue - blue) * p + blue,
  );
}