faintWith method

Color faintWith(
  1. Color other, [
  2. double factor = 0.9
])

Blends the color with a specific other color.

Useful for "fading" a color into a specific background or surface theme.

Implementation

Color faintWith(Color other, [double factor = 0.9]) {
  final double safeFactor = factor.clamp(0.0, 1.0);
  if (safeFactor == 0.0) return this;

  final Color blended = Color.lerp(this, other, safeFactor) ?? this;
  return blended.withValues(alpha: a);
}