Skip to content

Commit 1c8d4df

Browse files
committed
feat: use imported chevron png and match font size to 144px
1 parent 4a398b6 commit 1c8d4df

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

3.38 KB
Loading

.github/scripts/generate_showcase.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def main():
150150
url = "https://github.com/google/fonts/raw/main/ofl/poppins/Poppins-Bold.ttf"
151151
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
152152
font_bytes = BytesIO(urllib.request.urlopen(req).read())
153-
font = ImageFont.truetype(font_bytes, 140)
153+
font = ImageFont.truetype(font_bytes, 144)
154154
except Exception:
155155
font = ImageFont.load_default()
156156

@@ -173,21 +173,15 @@ def draw_rotated_text(text, cx, cy, alpha=255):
173173
draw_rotated_text("OFF", 90, 293, alpha=150)
174174
draw_rotated_text("ON", 90, 833, alpha=255)
175175

176-
# Draw left-pointing chevrons
177-
def draw_left_chevron(d, cx, cy, w, h, t, fill):
178-
poly = [
179-
(cx + w//2, cy - h//2),
180-
(cx - w//2, cy),
181-
(cx + w//2, cy + h//2),
182-
(cx + w//2 - t, cy + h//2),
183-
(cx - w//2 + t, cy),
184-
(cx + w//2 - t, cy - h//2)
185-
]
186-
d.polygon(poly, fill=fill)
187-
188-
# Chevrons aligned at cx=125, vertically stacked
189-
draw_left_chevron(draw, cx=125, cy=533, w=40, h=40, t=15, fill=(255, 255, 255, 150))
190-
draw_left_chevron(draw, cx=125, cy=593, w=40, h=40, t=15, fill=(255, 255, 255, 255))
176+
# Load and draw chevron image
177+
try:
178+
chevron_path = os.path.join(script_dir, "../images/vback_chevonrs_white.png")
179+
chevron_img = Image.open(chevron_path).convert("RGBA")
180+
chevron_img = chevron_img.rotate(90, expand=1)
181+
# Center the chevron between OFF and ON (cy: (293+833)/2 = 563)
182+
bg.alpha_composite(chevron_img, dest=(int(90 - chevron_img.width//2), int(563 - chevron_img.height//2)))
183+
except Exception as e:
184+
print(f"Failed to load chevron image: {e}")
191185

192186
os.makedirs(os.path.dirname(OUTPUT_PATH), exist_ok=True)
193187
bg.save(OUTPUT_PATH)

0 commit comments

Comments
 (0)