Feat: App-Icons für PWA hinzugefügt
This commit is contained in:
39
scripts/generate_icons.py
Normal file
39
scripts/generate_icons.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
import os
|
||||||
|
|
||||||
|
def create_icon(size):
|
||||||
|
# Erstelle ein neues Bild mit grünem Hintergrund
|
||||||
|
image = Image.new('RGB', (size, size), '#4CAF50')
|
||||||
|
draw = ImageDraw.Draw(image)
|
||||||
|
|
||||||
|
# Versuche, eine Schriftart zu laden
|
||||||
|
try:
|
||||||
|
font = ImageFont.truetype("arial.ttf", size // 3)
|
||||||
|
except:
|
||||||
|
font = ImageFont.load_default()
|
||||||
|
|
||||||
|
# Text "MEDI" zeichnen
|
||||||
|
text = "MEDI"
|
||||||
|
text_bbox = draw.textbbox((0, 0), text, font=font)
|
||||||
|
text_width = text_bbox[2] - text_bbox[0]
|
||||||
|
text_height = text_bbox[3] - text_bbox[1]
|
||||||
|
x = (size - text_width) // 2
|
||||||
|
y = (size - text_height) // 2
|
||||||
|
draw.text((x, y), text, fill='white', font=font)
|
||||||
|
|
||||||
|
# Speichere das Icon
|
||||||
|
output_file = f'static/images/icon-{size}x{size}.png'
|
||||||
|
image.save(output_file, 'PNG')
|
||||||
|
print(f'Icon {size}x{size} generiert: {output_file}')
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Erstelle das Verzeichnis, falls es nicht existiert
|
||||||
|
os.makedirs('static/images', exist_ok=True)
|
||||||
|
|
||||||
|
# Generiere Icons in verschiedenen Größen
|
||||||
|
sizes = [192, 512]
|
||||||
|
for size in sizes:
|
||||||
|
create_icon(size)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
BIN
static/images/icon-192x192.png
Normal file
BIN
static/images/icon-192x192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
static/images/icon-512x512.png
Normal file
BIN
static/images/icon-512x512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
25
static/images/icon.svg
Normal file
25
static/images/icon.svg
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<!-- Hintergrund -->
|
||||||
|
<rect width="512" height="512" fill="#4CAF50"/>
|
||||||
|
|
||||||
|
<!-- MEDI Text -->
|
||||||
|
<text x="256" y="300"
|
||||||
|
font-family="Arial, sans-serif"
|
||||||
|
font-size="200"
|
||||||
|
font-weight="bold"
|
||||||
|
fill="white"
|
||||||
|
text-anchor="middle">
|
||||||
|
MEDI
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<!-- Herz-Symbol -->
|
||||||
|
<path d="M256 150
|
||||||
|
C 256 150, 200 100, 150 100
|
||||||
|
C 100 100, 50 150, 50 200
|
||||||
|
C 50 250, 256 350, 256 350
|
||||||
|
C 256 350, 462 250, 462 200
|
||||||
|
C 462 150, 412 100, 362 100
|
||||||
|
C 312 100, 256 150, 256 150"
|
||||||
|
fill="white"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 775 B |
Reference in New Issue
Block a user