We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db42401 commit f785d75Copy full SHA for f785d75
shiny/ui/_theme_brand.py
@@ -392,19 +392,7 @@ def maybe_convert_font_size_to_rem(x: str) -> CssUnit:
392
393
394
def split_css_value_and_unit(x: str) -> tuple[str, str]:
395
- digit_chars = [".", *[str(s) for s in range(10)]]
396
-
397
- value = ""
398
- unit = ""
399
- in_unit = False
400
- for chr in x:
401
- if chr in digit_chars:
402
- if not in_unit:
403
- value += chr
404
- else:
405
- in_unit = True
406
407
- if in_unit:
408
- unit += chr
409
410
- return value.strip(), unit.strip()
+ match = re.match(r'^(-?\d*\.?\d+)([a-zA-Z%]*)$', x)
+ if not match:
+ raise ValueError(f"Invalid CSS value format: {x}")
+ return match.groups()
0 commit comments