Skip to content

Commit 40441c3

Browse files
committed
Add generated favicon
1 parent 3e1c1ee commit 40441c3

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

content/images/favicon.ico

2 KB
Binary file not shown.

create_favicon.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from PIL import Image, ImageDraw, ImageFont
2+
import os
3+
4+
# Create a 32x32 image with a dark background
5+
img = Image.new('RGBA', (32, 32), color=(40, 40, 40, 255))
6+
draw = ImageDraw.Draw(img)
7+
8+
# Try to use a system font, fallback to default if not found
9+
try:
10+
font = ImageFont.truetype("/System/Library/Fonts/Helvetica.ttc", 20)
11+
except:
12+
font = ImageFont.load_default()
13+
14+
# Draw the initials
15+
draw.text((6, 4), "PG", font=font, fill=(255, 255, 255, 255))
16+
17+
# Ensure the images directory exists
18+
os.makedirs('content/images', exist_ok=True)
19+
20+
# Save as favicon.ico
21+
img.save('content/images/favicon.ico', format='ICO')

0 commit comments

Comments
 (0)