so2html.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:chat 作者: cambridgeltl 项目源码 文件源码
def random_colors(n, seed=None):
    import random
    import colorsys

    random.seed(seed)

    # based on http://stackoverflow.com/a/470747
    colors = []
    for i in range(n):
        hsv = (1.*i/n, 0.9 + random.random()/10, 0.9 + random.random()/10)
        rgb = tuple(255*x for x in colorsys.hsv_to_rgb(*hsv))
        colors.append('#%02x%02x%02x' % rgb)
    return colors

# Kelly's high-contrast colors [K Kelly, Color Eng., 3 (6) (1965)],
# via http://stackoverflow.com/a/4382138. Changes: black excluded as
# not applicable here, plus some reordering (numbers in comments give
# original order).
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号