withRed method

Color withRed(
  1. int r
)

Returns a new color that matches this color with the red channel replaced with r (which ranges from 0 to 255).

Out of range values will have unexpected effects.

Implementation

Color withRed(int r) {
  return Color.fromARGB((a * 255.0).round() & 0xff, r,
      (g * 255.0).round() & 0xff, (b * 255.0).round() & 0xff);
}