Function
svg_node
(x: float, y: float, text: str, font_size: int, color: tuple[int, int, int])
Source from the content-addressed store, hash-verified
| 167 | |
| 168 | |
| 169 | def svg_node(x: float, y: float, text: str, font_size: int, color: tuple[int, int, int]) -> list[str]: |
| 170 | # Fixed-size nodes are sufficient here because all labels are known. |
| 171 | widths = {"TokenCost": 150, "Closed API": 160, "Open / open-access": 245} |
| 172 | w = widths[text] |
| 173 | h = 44 |
| 174 | return [ |
| 175 | f'<rect x="{x - w / 2}" y="{y - h / 2}" width="{w}" height="{h}" rx="8" fill="white" stroke="{rgb(color)}" stroke-width="2"/>', |
| 176 | f'<text x="{x}" y="{y + 8}" font-family="Times New Roman" font-size="{font_size}" font-weight="700" text-anchor="middle" fill="{rgb(color)}">{text}</text>', |
| 177 | ] |
| 178 | |
| 179 | |
| 180 | def write_svg() -> None: |
Tested by
no test coverage detected