Skip to content

Commit 81dd687

Browse files
committed
[stringbuilder] add segment_total_distance function
1 parent deac5fb commit 81dd687

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/pathins/stringbuilder.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,10 @@ def segment_quadratic_curve(
238238
f"({coord1.x},{coord1.y}) ({coord2.x},{coord2.y}) ({coord3.x},{coord3.y}): "
239239
f"QCURVE {round(distance, 2):.2f} units"
240240
)
241+
242+
243+
def segment_total_distance(distance: float, nocolor: bool = False) -> str:
244+
if not nocolor and IS_A_TTY:
245+
return f"{bold_text('Total')}: {round(distance, 2):.2f} units"
246+
else:
247+
return f"Total: {round(distance, 2):.2f} units"

0 commit comments

Comments
 (0)