- faicons version: favicons-0.2.0
- Python version: Python 3.11.5
- Operating System: MacOS Version 14.0 (23A339)
Description
when i try to pass in "100%" as a width string into favicons.icon_svg() I get a
raise ValueError(
ValueError: Values provided to `height` and `width` must have a numerical value followed by a CSS length unit.
What I Did
showcase=faicons.icon_svg('piggy-bank', width="100%")
Tracing through where the error is coming from:
https://github.com/posit-dev/py-faicons/blob/main/faicons/_core.py#L185
It seems that % is allowed as a _css_lenth_unit but the regex check is only looking for [a-z]+ after all the numbers, and is missing the ability to take in a % symbol
I think the fix could/should be changing the regex pattern to: "^^[0-9]*\\.?[0-9]+[a-z%]+$"