BaseRandomColor.withOpacity constructor

BaseRandomColor.withOpacity(
  1. double opacity
)

Fixed opacity

Implementation

BaseRandomColor.withOpacity(double opacity)
    : super(((((opacity * 0xff ~/ 1) & 0xff) << 24) |
              ((Random().nextInt(256) & 0xff) << 16) |
              ((Random().nextInt(256) & 0xff) << 8) |
              ((Random().nextInt(256) & 0xff) << 0)) &
          0xFFFFFFFF);