summaryrefslogtreecommitdiff
path: root/python/examples/export_svg.py
diff options
context:
space:
mode:
authormechanicalnull <mechanicalnull@gmail.com>2019-08-29 19:06:26 -0700
committerJordan <jordan@psifertex.com>2019-09-11 16:14:24 -0400
commit63132f7106624b0856bad85e7e7fcb4b2c881ccc (patch)
treeba086ff8afb03bdf2532ac44ce9c29ed076857c9 /python/examples/export_svg.py
parent5d01e8e553280f1f9e7676ea32af183f6e23efd7 (diff)
Support all colors of the rainbow in export_svg.py
Diffstat (limited to 'python/examples/export_svg.py')
-rwxr-xr-xpython/examples/export_svg.py11
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(