Files
py-flask-imageboard/scripts/create_favicon.py
2026-01-20 21:40:46 +00:00

37 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
Script to create a cool ASCII-art style favicon for the imageboard
"""
import os
from PIL import Image, ImageDraw, ImageFont
def create_favicon():
# Create a 32x32 image for the favicon
size = (32, 32)
img = Image.new('RGB', size, color=(248, 249, 250)) # Background color matching the theme
draw = ImageDraw.Draw(img)
# Draw a pixelated computer monitor
# Monitor base (rectangle)
draw.rectangle([6, 8, 26, 22], fill=(52, 58, 64)) # Dark gray for monitor
# Screen inside monitor
draw.rectangle([8, 10, 24, 20], fill=(0, 123, 255)) # Blue for screen
# Monitor stand
draw.rectangle([14, 22, 18, 26], fill=(52, 58, 64)) # Stand base
draw.rectangle([12, 24, 20, 26], fill=(52, 58, 64)) # Stand base wider part
# Pixelated details on screen (resembling text/pixels)
for x in range(10, 23, 3):
for y in range(12, 19, 3):
draw.rectangle([x, y, x+1, y+1], fill=(255, 255, 255)) # Small pixels
# Create the static directory if it doesn't exist
os.makedirs('frontend/static', exist_ok=True)
# Save as favicon.ico
img.save('frontend/static/favicon.ico', format='ICO', sizes=[(16, 16), (32, 32)])
print("Pixelated computer favicon created successfully!")
if __name__ == "__main__":
create_favicon()