mutedForDisabled function

Color mutedForDisabled(
  1. Color content,
  2. Color surface
)

Versão desabilitada de content sobre surface: dessatura (kDisabledChromaRetention) e desloca o tom para tomDaSurface ± kDisabledProminenceTone no sentido da cor original.

Substitui o idioma de opacidade (Color.disabled()), que some no tema escuro (dark sobre dark). Preserva a matiz (identidade da marca) e garante perceptibilidade + distinção do estado habilitado. Ver RULES §7.

Implementation

Color mutedForDisabled(Color content, Color surface) {
  final Hct c = Hct.fromInt(content.toARGB32());
  final Hct s = Hct.fromInt(surface.toARGB32());
  final double direction = c.tone >= s.tone ? 1.0 : -1.0;
  final double tone = (s.tone + direction * kDisabledProminenceTone).clamp(
    0.0,
    100.0,
  );
  return Color(
    Hct.from(c.hue, c.chroma * kDisabledChromaRetention, tone).toInt(),
  );
}