

def _split_colors(color, n):
    'Create n colors in HSV space that occupy a gradient in value\n\n    Parameters\n    ----------\n    color : tuple\n        RGBA tuple with values between 0 and 1.\n    n : int >= 2\n        Number of colors on the gradient.\n\n    Returns\n    -------\n    colors : tuple of tuples, len = n\n        N RGBA tuples that occupy a gradient in value (low to high) but share\n        saturation and hue with the input color.\n    '
    (r, g, b, a) = color
    (h, s, v) = rgb_to_hsv(r, g, b)
    gradient_range = np.sqrt((n / 10.0))
    if (v > 0.5):
        v_max = min(0.95, (v + (gradient_range / 2)))
        v_min = max(0.05, (v_max - gradient_range))
    else:
        v_min = max(0.05, (v - (gradient_range / 2)))
        v_max = min(0.95, (v_min + gradient_range))
    hsv_colors = ((h, s, v_) for v_ in np.linspace(v_min, v_max, n))
    rgb_colors = (hsv_to_rgb(h_, s_, v_) for (h_, s_, v_) in hsv_colors)
    rgba_colors = ((r_, g_, b_, a) for (r_, g_, b_) in rgb_colors)
    return tuple(rgba_colors)

dataset/ETHPy150Open mne-tools/mne-python/mne/label.py _split_colors/original