def set_color(cls, ea, rgb, **frame):
"""Sets the color of the basic-block at address ``ea`` to ``rgb``.
If the color ``frame`` is specified, set the frame to the specified color.
"""
res, fn, bb = cls.get_color(ea), by_address(ea), cls.id(ea)
n = idaapi.node_info_t()
# specify the bgcolor
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, n, f)
finally: idaapi.refresh_idaview_anyway()
# update the color of each item too
for ea in block.iterate(ea):
database.set_color(ea, rgb)
#internal.netnode.alt.set(ea, 0x14, n.bg_color)
return res
评论列表
文章目录