start.py 文件源码

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

项目:gpymusic 作者: christopher-dG 项目源码 文件源码
def set_colours(colours):
    """
    Set curses colours.

    Arguments:
    colours: Dict with colour information.
    """
    crs.start_color()
    # Define colours.
    if colours['background'] == 'default':
        crs.use_default_colors()
        background = -1
    else:
        crs.init_color(0, *hex_to_rgb(colours['background']))
        background = 0
    crs.init_color(1, *hex_to_rgb(colours['foreground']))
    crs.init_color(2, *hex_to_rgb(colours['highlight']))
    crs.init_color(3, *hex_to_rgb(colours['content1']))
    crs.init_color(4, *hex_to_rgb(colours['content2']))

    # Define colour pairs.
    crs.init_pair(1, 1, background)
    crs.init_pair(2, 2, background)
    crs.init_pair(3, 3, background)
    crs.init_pair(4, 4, background)

    # Set colours.
    crs.start_color()
    common.w.main.bkgdset(' ', crs.color_pair(1))
    common.w.inbar.bkgdset(' ', crs.color_pair(1))
    common.w.infobar.bkgdset(' ', crs.color_pair(2))
    common.w.outbar.bkgdset(' ', crs.color_pair(4))

    common.w.refresh()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号