(p)
| 290 | parts = [p.strip() for p in m.group(1).split(",")] |
| 291 | if len(parts) >= 3: |
| 292 | def to_int(p): |
| 293 | if p.endswith("%"): |
| 294 | # percentage to 0-255 |
| 295 | return clamp255(float(p[:-1]) * 255.0 / 100.0) |
| 296 | return clamp255(p) |
| 297 | r, g, b = to_int(parts[0]), to_int(parts[1]), to_int(parts[2]) |
| 298 | if None not in (r, g, b): |
| 299 | return (r, g, b) |
no test coverage detected