From 63132f7106624b0856bad85e7e7fcb4b2c881ccc Mon Sep 17 00:00:00 2001 From: mechanicalnull Date: Thu, 29 Aug 2019 19:06:26 -0700 Subject: Support all colors of the rainbow in export_svg.py --- python/examples/export_svg.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'python/examples') 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 += ' \n'.format( -- cgit v1.3.1