Color.createRgba constructor

Color.createRgba(
  1. int red,
  2. int green,
  3. int blue, [
  4. num? alpha,
])

RGB takes three values. The red, green, and blue parameters are the intensity of those components where '0' is the least and '256' is the greatest.

If alpha is provided, it is the level of translucency which ranges from '0' (completely transparent) to '1.0' (completely opaque). It will internally be mapped to an int between '0' and '255' like the other color components.

Implementation

Color.createRgba(int red, int green, int blue, [num? alpha])
    : _argb = Color.convertToHexString(
          Color._clamp(red, 0, 255),
          Color._clamp(green, 0, 255),
          Color._clamp(blue, 0, 255),
          alpha != null ? Color._clamp(alpha, 0, 1) : alpha);