Files
slp-modular-cms/frontend/themes/slpsoftware/contrast.py
T
SluijsensandClaude Sonnet 5.5 321234dfa6 CMS: één bannerlijst met Locatie, SLP-thema, thema-schakelaar, documentatie
- Banner-admin: één lijst met Locatie-badge (Boven/Onder), Locatie-keuzeveld in het formulier, "Live" en "Wordt niet getoond" per locatie, aan/uit per rij
- Thema slpsoftware: Archivo, bordeaux #7A1414 (WCAG AA licht en donker), <SLP/>-logo, favicon, mail-logo; VITE_THEME in de SLP-builds (test en productie-config)
- Thema-schakelaar: eerste klik wisselt altijd het getoonde thema (klasse op <html> als bron van waarheid, gedeelde status, startscript valideert opslag) + tests
- Docs: README, docs/cms-themas.md, docs/deploy-en-testomgevingen.md, docs/privacy-gegevens-contactformulier.md, aidlc-docs (offering-banners, bug theme-toggle-first-click)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 00:14:10 +01:00

13 lines
1.3 KiB
Python

def lum(h):
h=h.lstrip('#'); c=[int(h[i:i+2],16)/255 for i in (0,2,4)]
c=[x/12.92 if x<=0.03928 else ((x+0.055)/1.055)**2.4 for x in c]
return .2126*c[0]+.7152*c[1]+.0722*c[2]
def cr(a,b):
la,lb=sorted([lum(a),lum(b)],reverse=True); return (la+.05)/(lb+.05)
L=dict(bg='#ffffff',fg='#1a1a1a',card='#f7f7f7',primary='#7a1414',pf='#ffffff',muted='#f4f4f5',mfg='#5c5c5c',accent='#f6e9e9',afg='#7a1414',destr='#c62828',dfg='#ffffff',ring='#7a1414')
D=dict(bg='#141414',fg='#f5f5f5',card='#1e1e1e',primary='#e0646c',pf='#141414',muted='#2a2a2a',mfg='#b0b0b0',accent='#3a1f21',afg='#f0a0a6',destr='#ff7b72',dfg='#141414',ring='#e0646c')
for n,t in (('light',L),('dark',D)):
print(n)
for lab,a,b,m in [('foreground/background','fg','bg',4.5),('card-foreground/card','fg','card',4.5),('primary-foreground/primary','pf','primary',4.5),('primary(link)/background','primary','bg',4.5),('primary/card','primary','card',4.5),('muted-foreground/background','mfg','bg',4.5),('muted-foreground/card','mfg','card',4.5),('muted-foreground/muted','mfg','muted',4.5),('accent-foreground/accent','afg','accent',4.5),('destructive-foreground/destructive','dfg','destr',4.5),('destructive/background','destr','bg',4.5),('ring/background','ring','bg',3),('ring/card','ring','card',3)]:
r=cr(t[a],t[b]); print(f' {lab:38s}{r:6.2f} {"OK" if r>=m else "FAIL"} (min {m})')