revise method
def with every role's chroma range narrowed to the intent's chroma
level (and the base roles quietened for a neutral first colour).
Implementation
FamilyDefinition revise(FamilyDefinition def) {
final level = chroma;
final neutral = intent.colors.isNotEmpty && intent.colors.first.neutral;
if (level == null && !neutral && !centred) return def;
ChromaRange accent(ChromaRange r) => _narrow(r, level);
ChromaRange base(ChromaRange r) =>
neutral ? _neutral(r) : _narrow(r, level);
RoleRange role(RoleRange r, ChromaRange Function(ChromaRange) f) =>
RoleRange(r.lMilli, f(r.chroma));
RoleRanges ranges(RoleRanges r) => RoleRanges(
background: role(r.background, base),
surfaceOffsetMilli: r.surfaceOffsetMilli,
surfaceChroma: base(r.surfaceChroma),
digit: role(r.digit, base),
digitDuotoneChroma: base(r.digitDuotoneChroma),
function: role(r.function, base),
operator: role(r.operator, accent),
operatorMonochromeL: r.operatorMonochromeL,
equals: role(r.equals, accent),
labelStartLMilli: r.labelStartLMilli,
labelMaxChromaMilli: r.labelMaxChromaMilli,
accentChroma: accent(r.accentChroma),
minDigitAboveBackgroundMilli: r.minDigitAboveBackgroundMilli,
minDigitBelowBackgroundMilli: r.minDigitBelowBackgroundMilli,
minFunctionBelowDigitMilli: r.minFunctionBelowDigitMilli,
accentCuspOffsetMilli: r.accentCuspOffsetMilli,
accentCuspClampMilli: r.accentCuspClampMilli,
);
return def.revise(dark: ranges(def.dark), light: ranges(def.light));
}