docs: README, Abnahmeprotokoll, Brand-Bilder; Gitea statt GitHub/HACS
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
"""Generate the brand images HA serves from custom_components/ninlight/brand/ (HA >= 2026.3)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
OUT = Path(__file__).parents[1] / "custom_components" / "ninlight" / "brand"
|
||||
AMBER = (255, 176, 46, 255)
|
||||
DARK = (38, 38, 46, 255)
|
||||
|
||||
|
||||
def bulb(size: int) -> Image.Image:
|
||||
image = Image.new("RGBA", (size, size), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(image)
|
||||
s = size / 256
|
||||
draw.ellipse((56 * s, 24 * s, 200 * s, 168 * s), fill=AMBER)
|
||||
draw.rounded_rectangle((92 * s, 150 * s, 164 * s, 204 * s), radius=10 * s, fill=AMBER)
|
||||
for y in (206, 222):
|
||||
draw.rounded_rectangle((96 * s, y * s, 160 * s, (y + 10) * s), radius=5 * s, fill=DARK)
|
||||
draw.rounded_rectangle((112 * s, 236 * s, 144 * s, 246 * s), radius=5 * s, fill=DARK)
|
||||
return image
|
||||
|
||||
|
||||
def main() -> None:
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
for name, size in (
|
||||
("icon.png", 256),
|
||||
("icon@2x.png", 512),
|
||||
("logo.png", 256),
|
||||
("logo@2x.png", 512),
|
||||
):
|
||||
bulb(size).save(OUT / name)
|
||||
print(OUT / name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user