mix method

Color mix(
  1. Color toColor, [
  2. int amount = 50
])

Implementation

Color mix(Color toColor, [int amount = 50]) {
  final p = RangeError.checkValueInInterval(amount, 0, 100, 'amount') / 100;

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