Browse Source

Make style regex match only hex colors in helper.py.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
8dc4e2310d
1 changed files with 1 additions and 2 deletions
  1. +1
    -2
      helper.py

+ 1
- 2
helper.py View File

@@ -343,13 +343,12 @@ def panel_to_components(tree):
if not color: if not color:
style = el.get('style') style = el.get('style')
if 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) color = color_match.group(1)
if not color: if not color:
print(f"Cannot get color of component: {el}") print(f"Cannot get color of component: {el}")
continue continue


print(color)
color = color.lower() color = color.lower()


if color == '#ff0000' or color == '#f00' or color == 'red': if color == '#ff0000' or color == '#f00' or color == 'red':


Loading…
Cancel
Save