From 8dc4e2310d7a5c56632de3e2310400ccb27ed43f Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 18 Oct 2021 10:32:58 -0400 Subject: [PATCH] Make style regex match only hex colors in helper.py. --- helper.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helper.py b/helper.py index 374a4751..bbb7dd92 100755 --- a/helper.py +++ b/helper.py @@ -343,13 +343,12 @@ def panel_to_components(tree): if not color: style = el.get('style') if style: - color_match = re.search(r'fill:\S*(#.{6});', style) + color_match = re.search(r'fill:\S*(#[0-9a-fA-F]{6})', style) color = color_match.group(1) if not color: print(f"Cannot get color of component: {el}") continue - print(color) color = color.lower() if color == '#ff0000' or color == '#f00' or color == 'red':