设置深颜色的做法

在用graido做界面的时候,有个显示标签的圆角矩形,这个圆角矩形的背景色是随机的,rgb的每个颜色值都是0-255,但是发现有的背景色太浅,导致白色的标签文字看不清,其实只要把颜色值限制范围小一些,背景色就会深一些

def random_dark_color():
    # 生成较深的颜色代码
    color_code = "#{:02x}{:02x}{:02x}".format(
        np.random.randint(0, 128),
        np.random.randint(0, 128),
        np.random.randint(0, 128)
    )
    return color_code

 

posted @ 2024-02-02 09:14  海_纳百川  阅读(13)  评论(0)    收藏  举报
本站总访问量