feat: UX Colorize aspect ratios, landscape vs portrait

This commit is contained in:
Chris Huang-Leaver 2024-05-15 22:59:56 +10:00
parent 6308fb8b54
commit 1f4a01fc83
No known key found for this signature in database
GPG Key ID: 544A651875BD2E88
1 changed files with 6 additions and 1 deletions

View File

@ -510,7 +510,12 @@ def add_ratio(x):
a, b = x.replace('*', ' ').split(' ')[:2]
a, b = int(a), int(b)
g = math.gcd(a, b)
return f'{a}×{b} <span style="color: grey;"> \U00002223 {a // g}:{b // g}</span>'
portrait_color = "cyan"
landscape_color = "green"
square_color = "red"
color = landscape_color if a > b else portrait_color
color = square_color if a == b else color
return f'{a}×{b} <span style="color: grey;">\U00002223 </span> <span style="color: {color};"> {a // g}:{b // g}</span>'
default_aspect_ratio = add_ratio(default_aspect_ratio)