MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / to_int

Function to_int

demo/app.py:292–296  ·  view source on GitHub ↗
(p)

Source from the content-addressed store, hash-verified

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)

Callers 1

_parse_rgbFunction · 0.85

Calls 1

clamp255Function · 0.85

Tested by

no test coverage detected