MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / rgbStr

Function rgbStr

python/examples/export_svg.py:96–112  ·  view source on GitHub ↗

Given a token string name, look up the theme color for it and return as rbg(x,y,z) str

(tokenType)

Source from the content-addressed store, hash-verified

94 return f'Opcode: {padded}'
95
96def rgbStr(tokenType):
97 '''Given a token string name, look up the theme color for it and return as rbg(x,y,z) str'''
98 try:
99 color = eval(f'getThemeColor(ThemeColor.{tokenType})')
100 except:
101 color = None
102 if (not color):
103 try:
104 ctx = UIContext.activeContext()
105 view_frame = ctx.getCurrentViewFrame()
106 color = eval(f'getTokenColor(view_frame, InstructionTextTokenType.{tokenType})')
107 except:
108 return 'rgb(224, 224, 224)'
109 r = color.getRgb()[0]
110 g = color.getRgb()[1]
111 b = color.getRgb()[2]
112 return f"rgb({r}, {g}, {b})"
113
114def render_svg(function, offset, mode, form, showOpcodes, showAddresses, origname):
115 settings = DisassemblySettings()

Callers 1

render_svgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected