Color.fromRGBO constructor

Color.fromRGBO(
  1. int r,
  2. int g,
  3. int b,
  4. double opacity,
)

Creates a color from RGB channels and opacity from zero to one.

Implementation

Color.fromRGBO(int r, int g, int b, double opacity)
    : value = (((opacity.clamp(0, 1) * 255).round() & 255) << 24) |
          ((r & 255) << 16) |
          ((g & 255) << 8) |
          (b & 255);