fromRGB static method

Color fromRGB(
  1. int r,
  2. int g,
  3. int b
)

Implementation

static Color fromRGB(int r, int g, int b) {
  r = (r < 0) ? -r : r;
  g = (g < 0) ? -g : g;
  b = (b < 0) ? -b : b;
  r = (r > 255) ? 255 : r;
  g = (g > 255) ? 255 : g;
  b = (b > 255) ? 255 : b;
  return Color.fromInt(
    ((r & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (b & 0x0ff),
  );
}