#!/usr/bin/env python3 """Generate Daily Timer app icon - a stylized stopwatch/timer""" from PIL import Image, ImageDraw import math def create_timer_icon(size=1024): # Create image with transparent background img = Image.new('RGBA', (size, size), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) center = size // 2 margin = size // 10 radius = center - margin # Colors bg_color = (45, 55, 72, 255) # Dark blue-gray background ring_color = (99, 179, 237, 255) # Light blue ring accent_color = (72, 187, 120, 255) # Green accent hand_color = (255, 255, 255, 255) # White hands warning_color = (237, 137, 54, 255) # Orange warning segment # Draw circular background draw.ellipse( [margin, margin, size - margin, size - margin], fill=bg_color, outline=ring_color, width=size // 25 ) # Draw inner circle (face) inner_margin = margin + size // 12 draw.ellipse( [inner_margin, inner_margin, size - inner_margin, size - inner_margin], fill=(55, 65, 81, 255), outline=(75, 85, 99, 255), width=2 ) # Draw hour marks mark_radius_outer = radius - size // 20 mark_radius_inner = radius - size // 10 for i in range(12): angle = math.radians(i * 30 - 90) x1 = center + mark_radius_inner * math.cos(angle) y1 = center + mark_radius_inner * math.sin(angle) x2 = center + mark_radius_outer * math.cos(angle) y2 = center + mark_radius_outer * math.sin(angle) width = size // 40 if i % 3 == 0 else size // 60 draw.line([(x1, y1), (x2, y2)], fill=hand_color, width=width) # Draw progress arc (green, showing ~70% complete) arc_margin = margin + size // 30 draw.arc( [arc_margin, arc_margin, size - arc_margin, size - arc_margin], start=-90, end=160, fill=accent_color, width=size // 20 ) # Draw warning segment (orange, last 30%) draw.arc( [arc_margin, arc_margin, size - arc_margin, size - arc_margin], start=160, end=270, fill=warning_color, width=size // 20 ) # Draw minute hand (long) minute_length = radius * 0.65 minute_angle = math.radians(160 - 90) # Pointing to ~5:20 minute_end = ( center + minute_length * math.cos(minute_angle), center + minute_length * math.sin(minute_angle) ) draw.line([(center, center), minute_end], fill=hand_color, width=size // 40) # Draw second hand (thin, red) second_length = radius * 0.7 second_angle = math.radians(200 - 90) # Pointing to ~6:40 second_end = ( center + second_length * math.cos(second_angle), center + second_length * math.sin(second_angle) ) draw.line([(center, center), second_end], fill=(239, 68, 68, 255), width=size // 80) # Draw center dot dot_radius = size // 25 draw.ellipse( [center - dot_radius, center - dot_radius, center + dot_radius, center + dot_radius], fill=ring_color ) # Draw small button on top (timer button) button_width = size // 12 button_height = size // 10 button_x = center - button_width // 2 button_y = margin - button_height // 2 draw.rectangle( [button_x, button_y, button_x + button_width, button_y + button_height], fill=ring_color, outline=bg_color, width=2 ) return img if __name__ == "__main__": icon = create_timer_icon(1024) output_path = "/Users/admin-msk/git/daily-timer/build/appicon.png" icon.save(output_path, "PNG") print(f"Icon saved to {output_path}")