def random_color_neighbour(
    rgb,
    hue_diff=0.0,
    sat_diff=0.0,
    val_diff=0.0,
    only_less_hue=False,
    only_less_sat=False,
    only_less_val=False,
    only_more_hue=False,
    only_more_sat=False,
    only_more_val=False,
):
    """
    returns a random color in the neighbourhood of the given one
    :param color: (r, g, b) or (r, g, b, a)
    :param hue_diff: maximum change in hue, if none all hue is allowed
    :param sat_diff: maximum change in saturation
    :param val_diff: maximum change in value
    :param only_less_hue: only small hue values smaller than the one provided
        in rgb
    :param only_less_sat:
    :param only_less_val:
    :param only_more_hue:
    :param only_more_sat:
    :param only_more_val:
    :return: (r, g, b) or (r, g, b, a) depending in the input
    """
    assert not (only_less_hue and only_more_hue)
    assert not (only_less_sat and only_more_sat)
    assert not (only_less_val and only_more_val)

    hsv, a = _rgb_to_hsv(rgb)

    def sample(x, diff, low=0, high=1, only_less=False, only_more=False):
        """
        sample a float from max(0, x-diff) and min(1, x+diff) if diff is not
        None. Else sample a number from low to high
        :param only_less: valid when diff is not None. only samples a small
            value
        :param only_more:
        """
        if diff is None:
            out = np.random.uniform(low, high)
        else:
            lb = max(0, x) if only_more else max(0, x - diff)
            ub = min(1, x) if only_less else min(1, x + diff)
            out = np.random.uniform(lb, ub)
        return out

    hsv[0] = sample(hsv[0], hue_diff, only_less=only_less_hue, only_more=only_more_hue)
    hsv[1] = sample(hsv[1], sat_diff, only_less=only_less_sat, only_more=only_more_sat)
    hsv[2] = sample(hsv[2], val_diff, only_less=only_less_val, only_more=only_more_val)

    rgb = _hsv_to_rgb(hsv, a)

    return rgb

    returns a random color in the neighbourhood of the given one
    :param color: (r, g, b) or (r, g, b, a)
    :param hue_diff: maximum change in hue, if none all hue is allowed
    :param sat_diff: maximum change in saturation
    :param val_diff: maximum change in value
    :param only_less_hue: only small hue values smaller than the one provided
        in rgb
    :param only_less_sat:
    :param only_less_val:
    :param only_more_hue:
    :param only_more_sat:
    :param only_more_val:
    :return: (r, g, b) or (r, g, b, a) depending in the input
    
infinigen/core/util/random.py