def _get_app_colors(app): color = 0 for ch in app: color += ord(ch) * int('754321', 16) color = int(color % int('ffffff', 16)) fillcolor = format_color(hex(color)) fontcolor = format_color(hex(abs(color - int('7fffff', 16)))) return (fillcolor, fontcolor)
def _get_app_colors(app): color = 0 for ch in app: color += ord(ch) * int('754321', 16) color = int(color % int('ffffff', 16)) fillcolor = format_color(hex(color)) fontcolor = format_color(hex(abs(color - int('7fffff', 16)))) return (fillcolor, fontcolor)
def mark_cycle(gr, cycle, number_cycle, gr_copy, use_colors=True): i = 0 cycle_color = None while i < len(cycle): item = cycle[i] try: next_item = cycle[i + 1] except IndexError: next_item = cycle[0] weight = gr.edge_weight((item, next_item)) gr.set_edge_label((item, next_item), "%s %s (%s)" % (unicode(CYCLE_LABEL), number_cycle, weight)) gr_copy.del_edge((item, next_item)) i += 1 if use_colors: if not cycle_color: cycle_color = format_color(hex((number_cycle * int('369369', 16) + int(CYCLE_COLOR_SEED, 16)) % int('ffffff', 16))) gr.add_edge_attribute((item, next_item), ("color", cycle_color)) gr.add_edge_attribute((item, next_item), ("fontcolor", cycle_color))
def mark_cycle(gr, cycle, number_cycle, gr_copy, use_colors=True): i = 0 cycle_color = None while i < len(cycle): item = cycle[i] try: next_item = cycle[i + 1] except IndexError: next_item = cycle[0] weight = gr.edge_weight((item, next_item)) gr.set_edge_label( (item, next_item), "%s %s (%s)" % (unicode(CYCLE_LABEL), number_cycle, weight)) gr_copy.del_edge((item, next_item)) i += 1 if use_colors: if not cycle_color: cycle_color = format_color( hex((number_cycle * int('369369', 16) + int(CYCLE_COLOR_SEED, 16)) % int('ffffff', 16))) gr.add_edge_attribute((item, next_item), ("color", cycle_color)) gr.add_edge_attribute((item, next_item), ("fontcolor", cycle_color))