Parse a font size value, if number set as px
(value: Union[str, int, float])
| 454 | |
| 455 | |
| 456 | def parse_font_size(value: Union[str, int, float]) -> str: |
| 457 | """Parse a font size value, if number set as px""" |
| 458 | if isinstance(value, (int, float)): |
| 459 | return f"{value}px" |
| 460 | |
| 461 | if (value[-3:] != "rem") and (value[-2:] not in ["em", "px"]): |
| 462 | raise ValueError("The font size must be expressed in rem, em, or px.") |
| 463 | return value |
no outgoing calls