clearKeyViolations function
The AC rules clear breaks for spec (empty: it passes): label
(below the theme's label floor on its face), distinct (too close to
another key face), or family:<rule> (a family guardrail it breaks in
its template's place). Tests and diagnostics.
Implementation
List<String> clearKeyViolations(ThemeSpec spec, KeyColors clear) {
final lim = GuardrailLimits.forSpec(spec);
final bgs = backgroundSamples(spec.background);
final out = <String>[];
for (final f in faceSamples(clear.face, bgs)) {
if (contrastOver(clear.label, f) < lim.labelRatio) {
out.add('label');
break;
}
}
if (_distinctness(spec, clear, bgs) < 1) out.add('distinct');
final original = {for (final v in validateTheme(spec)) v.rule};
for (final rule in _familyViolations(spec, clear, original)) {
out.add('family:${rule.name}');
}
return out;
}