def generate_random_colors(n, seed=5218):
if seed is not None:
np.random.seed(seed)
colors = []
for i in range(n):
hue = 0.05 + i / n # we want maximizing hue
lightness = 0.4 + np.random.rand(1)[0] / 3 # lightness
saturation = 0.5 + np.random.rand(1)[0] / 10 # saturation
rgb = colorsys.hls_to_rgb(hue, lightness, saturation)
colors.append(rgb)
return colors
# ===========================================================================
# Helper for spectrogram
# ===========================================================================
评论列表
文章目录