transparency method
Adjusts the alpha channel of the color based on a fraction.
fraction : A value between 0.0 (transparent) and 1.0 (opaque).
Edge Case: If input is out of range, it is automatically clamped.
Implementation
Color transparency(double fraction) {
final double safeFraction = fraction.clamp(0.0, 1.0);
return withValues(alpha: safeFraction);
}