def random_color(rgb=True, maximum=255):
    """
    Reference: https://github.com/facebookresearch/detectron2/blob/master/detectron2/utils/colormap.py#L111

    Args:
        rgb (bool, optional): Whether or not to return RGB colors or BGR colors. Default: True.
        maximum (int, optional): Either 255 or 1. Default: 255.

    Returns:
        ndarray: a vector of 3 numbers.
    """
    idx = np.random.randint(0, len(_COLORS))
    ret = _COLORS[idx] * maximum
    if not rgb:
        ret = ret[::-1]
    return ret

    Reference: https://github.com/facebookresearch/detectron2/blob/master/detectron2/utils/colormap.py#L111

    Args:
        rgb (bool, optional): Whether or not to return RGB colors or BGR colors. Default: True.
        maximum (int, optional): Either 255 or 1. Default: 255.

    Returns:
        ndarray: a vector of 3 numbers.
    
contrib/PanopticSeg/paddlepanseg/utils/visualize.py