Add ALD Transition Console preview and Astra lab build workflow

This commit is contained in:
scandalist-trash committed 2026-10-27 10:50:43 -04:00
1 parent f330a3c00a
commit e5c6a2fc0e
199 files changed
+9866

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env python3
"""Measure declared opaque token pairs; this is not a rendered GUI/a11y test."""
from pathlib import Path
import re
root=Path(__file__).resolve().parents[1]
tokens=dict(re.findall(r'(\w+)="(#[A-Fa-f0-9]{6})"',(root/'src/ui/Theme.h').read_text()))
def luminance(color):
channels=[int(color[i:i+2],16)/255 for i in (1,3,5)]
channels=[v/12.92 if v<=.04045 else ((v+.055)/1.055)**2.4 for v in channels]
return sum(a*b for a,b in zip(channels,(.2126,.7152,.0722)))
for front,back,required in [('text','background',4.5),('text','panel',4.5),('secondary','panel',4.5),('warning','panel',4.5),('background','accent',4.5),('accent','panel',4.5),('accent','elevated',3)]:
hi,lo=sorted([luminance(tokens[front]),luminance(tokens[back])],reverse=True);ratio=(hi+.05)/(lo+.05)
print(f'{front}/{back}: {ratio:.2f}:1 (required {required}:1)');assert ratio>=required
print('PASS: declared text/focus token contrast; rendered, high-contrast-mode and screen-reader checks remain pending')