def set_color(cls, bb, rgb, **frame):
"""Sets the color of the basic-block ``bb`` to ``rgb``.
If the color ``frame`` is specified, set the frame to the specified color.
"""
res, fn, n = cls.get_color(bb), by_address(bb.startEA), idaapi.node_info_t()
# specify the bg color
r,b = (rgb&0xff0000) >> 16, rgb&0x0000ff
n.bg_color = n.frame_color = (b<<16)|(rgb&0x00ff00)|r
# now the frame color
frgb = frame.get('frame', 0x000000)
fr, fb = (frgb & 0xff0000) >> 16, frgb&0x0000ff
n.frame_color = (fb<<16)|(frgb&0x00ff00)|fr
# set the node
f = (idaapi.NIF_BG_COLOR|idaapi.NIF_FRAME_COLOR) if frame else idaapi.NIF_BG_COLOR
try: idaapi.set_node_info2(fn.startEA, bb.id, n, f)
finally: idaapi.refresh_idaview_anyway()
# update the colors of each item too.
for ea in block.iterate(bb):
database.set_color(ea, rgb)
#internal.netnode.alt.set(ea, 0x14, n.bg_color)
return res
评论列表
文章目录