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()
评论列表
文章目录