lerp static method

Linearly interpolates between two styles.

Implementation

static HighlightStyle? lerp(HighlightStyle? a, HighlightStyle? b, double t) {
  if (a == null && b == null) {
    return null;
  }
  if (a == null) {
    return t < 0.5 ? null : b;
  }
  if (b == null) {
    return t < 0.5 ? a : null;
  }
  return HighlightStyle(
    backgroundColor: Color.lerp(a.backgroundColor, b.backgroundColor, t),
    color: Color.lerp(a.color, b.color, t),
  );
}