diff options
| author | mechanicalnull <mechanicalnull@gmail.com> | 2019-08-29 19:06:26 -0700 |
|---|---|---|
| committer | Jordan <jordan@psifertex.com> | 2019-09-11 16:14:24 -0400 |
| commit | 63132f7106624b0856bad85e7e7fcb4b2c881ccc (patch) | |
| tree | ba086ff8afb03bdf2532ac44ce9c29ed076857c9 /python/examples | |
| parent | 5d01e8e553280f1f9e7676ea32af183f6e23efd7 (diff) | |
Support all colors of the rainbow in export_svg.py
Diffstat (limited to 'python/examples')
| -rwxr-xr-x | python/examples/export_svg.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/python/examples/export_svg.py b/python/examples/export_svg.py index 673aa59c..660af780 100755 --- a/python/examples/export_svg.py +++ b/python/examples/export_svg.py @@ -179,10 +179,13 @@ def render_svg(function, origname): rgb = colors['none'] try: bb = block.basic_block - color_code = bb.highlight.color - color_str = bb.highlight._standard_color_to_str(color_code) - if color_str in colors: - rgb = colors[color_str] + if hasattr(bb.highlight, 'color'): + color_code = bb.highlight.color + color_str = bb.highlight._standard_color_to_str(color_code) + if color_str in colors: + rgb = colors[color_str] + else: + rgb = [bb.highlight.red, bb.highlight.green, bb.highlight.blue] except: pass output += ' <rect class="basicblock" x="{x}" y="{y}" fill-opacity="0.4" height="{height}" width="{width}" fill="rgb({r},{g},{b})"/>\n'.format( |
