def fs_from_match(d): atts = {} if d['fg']: # this isn't according to spec as I understand it if d['fg'].isupper(): d['bold'] = True #TODO figure out why boldness isn't based on presence of \x02 color = cnames[d['fg'].lower()] if color != 'default': atts['fg'] = FG_COLORS[color] if d['bg']: if d['bg'] == 'I': color = colors[(colors.index(color) + (len(colors) // 2)) % len(colors)] # hack for finding the "inverse" else: color = cnames[d['bg'].lower()] if color != 'default': atts['bg'] = BG_COLORS[color] if d['bold']: atts['bold'] = True return fmtstr(d['string'], **atts)
def fs_from_match(d): atts = {} if d["fg"]: # this isn't according to spec as I understand it if d["fg"].isupper(): d["bold"] = True # TODO figure out why boldness isn't based on presence of \x02 color = cnames[d["fg"].lower()] if color != "default": atts["fg"] = FG_COLORS[color] if d["bg"]: if d["bg"] == "I": # hack for finding the "inverse" color = colors[(colors.index(color) + (len(colors) // 2)) % len(colors)] else: color = cnames[d["bg"].lower()] if color != "default": atts["bg"] = BG_COLORS[color] if d["bold"]: atts["bold"] = True return fmtstr(d["string"], **atts)
def fs_from_match(d): atts = {} if d['fg']: # this isn't according to spec as I understand it if d['fg'].isupper(): d['bold'] = True # TODO figure out why boldness isn't based on presence of \x02 color = cnames[d['fg'].lower()] if color != 'default': atts['fg'] = FG_COLORS[color] if d['bg']: if d['bg'] == 'I': # hack for finding the "inverse" color = colors[(colors.index(color) + (len(colors) // 2)) % len(colors)] else: color = cnames[d['bg'].lower()] if color != 'default': atts['bg'] = BG_COLORS[color] if d['bold']: atts['bold'] = True return fmtstr(d['string'], **atts)