Files

46 lines
1.6 KiB
Python

import sys
from pathlib import Path
from PIL import Image, ImageDraw
def build(path: Path, size: int) -> None:
# The fnOS mobile launcher already applies its own icon mask. Transparent
# corners are composited against black in the app, so keep the full canvas
# opaque and let the branded background run all the way to every edge.
image = Image.new("RGBA", (size, size), (103, 145, 244, 255))
draw = ImageDraw.Draw(image)
center = size // 2
radius = size // 5
draw.ellipse(
(center - radius, center - radius, center + radius, center + radius),
outline=(255, 255, 255, 245),
width=max(2, size // 25),
)
sparkle = size // 13
draw.polygon(
[
(size * 3 // 4, size // 5),
(size * 3 // 4 + sparkle, size // 3),
(size * 7 // 8, size // 3 + sparkle),
(size * 3 // 4 + sparkle, size // 3 + sparkle * 2),
(size * 3 // 4, size // 2),
(size * 3 // 4 - sparkle, size // 3 + sparkle * 2),
(size * 5 // 8, size // 3 + sparkle),
(size * 3 // 4 - sparkle, size // 3),
],
fill=(255, 255, 255, 255),
)
image.save(path, "PNG")
if __name__ == "__main__":
destination = Path(sys.argv[1])
destination.mkdir(parents=True, exist_ok=True)
build(destination / "ICON.PNG", 128)
build(destination / "ICON_256.PNG", 256)
ui_images = destination / "app" / "ui" / "images"
ui_images.mkdir(parents=True, exist_ok=True)
build(ui_images / "icon_64.png", 64)
build(ui_images / "icon_256.png", 256)