rapid interations of server side app and firefox extension
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Generate placeholder icons for the GallerySubscriber extension.
|
||||
Run this script from the extension directory.
|
||||
|
||||
Requirements: Pillow (pip install Pillow)
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
from PIL import Image, ImageDraw
|
||||
except ImportError:
|
||||
print("Pillow not installed. Install with: pip install Pillow")
|
||||
print("Or manually create icon-16.png, icon-32.png, icon-48.png, icon-128.png")
|
||||
exit(1)
|
||||
|
||||
# Icon configuration
|
||||
BACKGROUND_COLOR = '#1976d2' # Primary blue
|
||||
SIZES = [16, 32, 48, 128]
|
||||
|
||||
def create_icon(size):
|
||||
"""Create a simple colored square icon with rounded corners effect."""
|
||||
img = Image.new('RGBA', (size, size), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Draw filled rounded rectangle (approximated with circle corners for small sizes)
|
||||
margin = max(1, size // 16)
|
||||
radius = max(2, size // 8)
|
||||
|
||||
# For simplicity, just draw a solid square with the primary color
|
||||
draw.rectangle([margin, margin, size - margin - 1, size - margin - 1],
|
||||
fill=BACKGROUND_COLOR)
|
||||
|
||||
# Draw a simple "G" or download arrow for larger sizes
|
||||
if size >= 32:
|
||||
# Draw a simple download arrow
|
||||
center_x = size // 2
|
||||
center_y = size // 2
|
||||
arrow_size = size // 3
|
||||
|
||||
# Arrow body (vertical line)
|
||||
line_width = max(2, size // 12)
|
||||
draw.rectangle([
|
||||
center_x - line_width // 2,
|
||||
center_y - arrow_size // 2,
|
||||
center_x + line_width // 2,
|
||||
center_y + arrow_size // 4
|
||||
], fill='white')
|
||||
|
||||
# Arrow head (triangle pointing down)
|
||||
head_size = arrow_size // 2
|
||||
draw.polygon([
|
||||
(center_x - head_size, center_y),
|
||||
(center_x + head_size, center_y),
|
||||
(center_x, center_y + head_size)
|
||||
], fill='white')
|
||||
|
||||
# Base line
|
||||
draw.rectangle([
|
||||
center_x - arrow_size // 2,
|
||||
center_y + arrow_size // 2,
|
||||
center_x + arrow_size // 2,
|
||||
center_y + arrow_size // 2 + line_width
|
||||
], fill='white')
|
||||
|
||||
return img
|
||||
|
||||
def main():
|
||||
icons_dir = Path(__file__).parent / 'icons'
|
||||
icons_dir.mkdir(exist_ok=True)
|
||||
|
||||
for size in SIZES:
|
||||
icon = create_icon(size)
|
||||
output_path = icons_dir / f'icon-{size}.png'
|
||||
icon.save(output_path, 'PNG')
|
||||
print(f'Created {output_path}')
|
||||
|
||||
print('\nDone! Icons created successfully.')
|
||||
print('You can replace these with custom icons later.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user