Add channel colours: per channel or link group, unique per DSP, shown in mixer, channel view, routing and overlays

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-01 22:52:21 +01:00
1 parent a7ee66d761
commit eb647f62a9
6 files changed
+141 -11

No files matched your search

+17 -1
View File
@@ -126,6 +126,17 @@ def clean_soundfield(data) -> dict:
}
def clean_colors(v) -> dict:
"""Channel colours: {"in0": "#rrggbb", "out3": ...}. Linked channels carry their group's colour; that a colour
belongs to one channel/group only is ensured by the colour picker (it knows the link groups)."""
out = {}
for k, c in (v.items() if isinstance(v, dict) else []):
c = str(c).lower()
if re.fullmatch(r"(in|out)\d{1,2}", str(k)) and re.fullmatch(r"#[0-9a-f]{6}", c):
out[str(k)] = c
return out
def clean_gains(v) -> list[int] | None:
"""Saved output gains of an interrupted audio test (from config.json)."""
if not isinstance(v, list) or not v or len(v) > 8:
@@ -283,7 +294,7 @@ class App:
bool(d.get("autoconnect", True)), on_event=self.broadcast,
transport="usb" if usb else "tcp", usb=str(d.get("usb") or ""),
lock_code=str(d.get("lock_code") or ""), auto_unlock=bool(d.get("auto_unlock")),
test_saved=clean_gains(d.get("test_saved")))
test_saved=clean_gains(d.get("test_saved")), colors=clean_colors(d.get("colors")))
dev.on_online = self.device_online
self.devices[dev_id] = dev
if dev.autoconnect:
@@ -744,6 +755,11 @@ class App:
if action == "refresh":
await dev.refresh()
return {"ok": True}
if action == "colors": # display only, stays in the app (the DSP doesn't know colours)
dev.colors = clean_colors(body.get("colors"))
self.save()
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
return {"ok": True, "colors": dev.colors}
if action == "test":
return await self.audio_test(dev, body)
if action == "testlevel":