""" Script to create proper PNG icons with house and car symbols """ import os from pathlib import Path from PIL import Image, ImageDraw, ImageFont def create_proper_icons(): static_dir = Path("/Users/wn/Workspace/home-automation/apps/ui/static") # Create home icon with house symbol def create_home_icon(size): img = Image.new('RGBA', (size, size), color=(102, 126, 234, 255)) # #667EEA draw = ImageDraw.Draw(img) # Calculate proportions margin = size // 10 house_size = size - 2 * margin # Draw house shape # Base rectangle base_height = house_size // 2 base_y = size - margin - base_height draw.rectangle([margin, base_y, size - margin, size - margin], fill='white') # Roof triangle roof_height = house_size // 3 roof_points = [ (size // 2, margin), # top point (margin, base_y), # bottom left (size - margin, base_y) # bottom right ] draw.polygon(roof_points, fill='white') # Door door_width = house_size // 6 door_height = base_height // 2 door_x = size // 2 - door_width // 2 door_y = size - margin - door_height draw.rectangle([door_x, door_y, door_x + door_width, size - margin], fill=(102, 126, 234, 255)) # Window window_size = house_size // 8 window_x = margin + house_size // 4 window_y = base_y + base_height // 4 draw.rectangle([window_x, window_y, window_x + window_size, window_y + window_size], fill=(102, 126, 234, 255)) return img # Create car icon with car symbol def create_car_icon(size): img = Image.new('RGBA', (size, size), color=(102, 126, 234, 255)) # #667EEA draw = ImageDraw.Draw(img) # Calculate proportions margin = size // 8 car_width = size - 2 * margin car_height = car_width // 2 car_y = size // 2 - car_height // 2 # Draw car body draw.rounded_rectangle([margin, car_y, size - margin, car_y + car_height], radius=size//20, fill='white') # Draw car roof roof_margin = car_width // 4 roof_height = car_height // 2 roof_y = car_y - roof_height // 2 draw.rounded_rectangle([margin + roof_margin, roof_y, size - margin - roof_margin, car_y + roof_height // 2], radius=size//30, fill='white') # Draw wheels wheel_radius = car_height // 4 wheel_y = car_y + car_height - wheel_radius // 2 # Left wheel left_wheel_x = margin + car_width // 4 draw.ellipse([left_wheel_x - wheel_radius, wheel_y - wheel_radius, left_wheel_x + wheel_radius, wheel_y + wheel_radius], fill=(102, 126, 234, 255)) # Right wheel right_wheel_x = size - margin - car_width // 4 draw.ellipse([right_wheel_x - wheel_radius, wheel_y - wheel_radius, right_wheel_x + wheel_radius, wheel_y + wheel_radius], fill=(102, 126, 234, 255)) return img # Sizes to create sizes = [16, 32, 57, 60, 72, 76, 114, 120, 144, 152, 180] # Create home icons for size in sizes: home_icon = create_home_icon(size) home_icon.save(static_dir / f"apple-touch-icon-{size}x{size}.png") print(f"Created apple-touch-icon-{size}x{size}.png") # Also create the main apple-touch-icon.png main_icon = create_home_icon(180) main_icon.save(static_dir / "apple-touch-icon.png") print("Created apple-touch-icon.png") # Create garage icons for size in sizes: car_icon = create_car_icon(size) car_icon.save(static_dir / f"garage-icon-{size}x{size}.png") print(f"Created garage-icon-{size}x{size}.png") # Also create the main garage-icon.png main_garage = create_car_icon(180) main_garage.save(static_dir / "garage-icon.png") print("Created garage-icon.png") if __name__ == "__main__": create_proper_icons()