diff --git a/README.md b/README.md index cb32678..f102fc4 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,14 @@ geht dann trotzdem. Die Integration wird in der gemeinsamen Dev-Instanz `ha-dev` per Mount eingebunden, der Quellcode bleibt in diesem Repo. +### Markenbilder + +`scripts/make_brand.py` zeichnet die vier PNGs unter +`custom_components/ninstrip/brand/`. Ab Home Assistant 2026.3 liefert HA sie +für eine eigene Integration von dort aus; ohne sie bleibt in der +Geräteübersicht ein Platzhalter. Das Motiv ist ein Strip mit fünf leuchtenden +Pixeln — ninlight hat an derselben Stelle eine Glühbirne. + ### Tests ``` diff --git a/custom_components/ninstrip/brand/icon.png b/custom_components/ninstrip/brand/icon.png new file mode 100644 index 0000000..e594dd7 Binary files /dev/null and b/custom_components/ninstrip/brand/icon.png differ diff --git a/custom_components/ninstrip/brand/icon@2x.png b/custom_components/ninstrip/brand/icon@2x.png new file mode 100644 index 0000000..f9ff975 Binary files /dev/null and b/custom_components/ninstrip/brand/icon@2x.png differ diff --git a/custom_components/ninstrip/brand/logo.png b/custom_components/ninstrip/brand/logo.png new file mode 100644 index 0000000..e594dd7 Binary files /dev/null and b/custom_components/ninstrip/brand/logo.png differ diff --git a/custom_components/ninstrip/brand/logo@2x.png b/custom_components/ninstrip/brand/logo@2x.png new file mode 100644 index 0000000..f9ff975 Binary files /dev/null and b/custom_components/ninstrip/brand/logo@2x.png differ diff --git a/scripts/make_brand.py b/scripts/make_brand.py new file mode 100644 index 0000000..b1bfd78 --- /dev/null +++ b/scripts/make_brand.py @@ -0,0 +1,65 @@ +"""Erzeugt die Markenbilder, die HA aus custom_components/ninstrip/brand/ ausliefert. + +Ab Home Assistant 2026.3 nimmt HA fuer eine eigene Integration die Bilder aus +diesem Ordner - ohne sie bleibt in der Geraeteuebersicht ein Platzhalter. +ha-ninlight macht es genauso (dort eine Gluehbirne), hier ist es ein Strip: +ein dunkles Band mit fuenf leuchtenden Pixeln in Regenbogenfarben, weil genau +das den Unterschied zu ninlight ausmacht - viele Pixel statt einer Lampe. +""" + +from __future__ import annotations + +from pathlib import Path + +from PIL import Image, ImageDraw, ImageFilter + +OUT = Path(__file__).parents[1] / "custom_components" / "ninstrip" / "brand" +DUNKEL = (38, 38, 46, 255) +# Rot, Gelb, Gruen, Cyan, Blau - eine Reihe, wie sie ein Lauflicht zeigt. +PIXEL = [ + (255, 64, 64, 255), + (255, 176, 46, 255), + (64, 224, 96, 255), + (64, 208, 232, 255), + (96, 112, 255, 255), +] + + +def strip(size: int) -> Image.Image: + s = size / 256 + bild = Image.new("RGBA", (size, size), (0, 0, 0, 0)) + + # Der Schein liegt unter dem Band und wird geweichzeichnet - sonst sehen + # die Pixel aus wie aufgemalte Punkte statt wie Licht. + schein = Image.new("RGBA", (size, size), (0, 0, 0, 0)) + male = ImageDraw.Draw(schein) + for i, farbe in enumerate(PIXEL): + x = (40 + i * 44) * s + male.ellipse((x - 30 * s, 90 * s, x + 30 * s, 166 * s), fill=(*farbe[:3], 130)) + schein = schein.filter(ImageFilter.GaussianBlur(radius=max(1.0, 9 * s))) + bild.alpha_composite(schein) + + male = ImageDraw.Draw(bild) + male.rounded_rectangle((12 * s, 92 * s, 244 * s, 164 * s), radius=22 * s, fill=DUNKEL) + for i, farbe in enumerate(PIXEL): + x = (40 + i * 44) * s + male.ellipse((x - 19 * s, 109 * s, x + 19 * s, 147 * s), fill=farbe) + # Kleines Glanzlicht, damit die Pixel gewoelbt wirken. + male.ellipse((x - 8 * s, 115 * s, x + 1 * s, 124 * s), fill=(255, 255, 255, 110)) + return bild + + +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), + ): + strip(size).save(OUT / name) + print(OUT / name) + + +if __name__ == "__main__": + main()