BaseRandomColor.fromRGBO constructor

BaseRandomColor.fromRGBO({
  1. int? r,
  2. int? g,
  3. int? b,
  4. double? opacity,
})

Same as Color.fromRGBO, if parameter has value, lock that value

Implementation

BaseRandomColor.fromRGBO({int? r, int? g, int? b, double? opacity})
    : super((((((opacity ?? Random().nextDouble()) * 0xff ~/ 1) & 0xff) << 24) |
              (((r ?? Random().nextInt(256)) & 0xff) << 16) |
              (((g ?? Random().nextInt(256)) & 0xff) << 8) |
              (((b ?? Random().nextInt(256)) & 0xff) << 0)) &
          0xFFFFFFFF);