average method Null safety

Color average(
  1. Color other,
  2. [dynamic strength]
)

Average the alpha, red, green, and blue channels of a Color with another other.

The resultant alpha may be overridden by providing a strength.

See alphaFromStrength for details on using a value between 0..1 or 2..255 as a shortcut for specifying alpha/opacity override.

Exposure method for ~/ operator, providing strength.

Implementation

Color average(Color other, [dynamic strength]) =>
    withAlpha(alphaFromStrength(strength) ?? alpha) ~/ other;