reportFor method

List<IntentNote> reportFor(
  1. ThemeFamily family
)

The hints family cannot honour (empty when it honours them all), at the newest engine version. Static: no theme is generated.

Implementation

List<IntentNote> reportFor(ThemeFamily family) {
  final notes = <IntentNote>[];
  if (!steerableFamilies.contains(family)) {
    const reason = 'family not steerable yet';
    if (brightness != null) {
      notes.add(IntentNote('brightness', brightness!.name, reason));
    }
    for (final c in colors) {
      notes.add(IntentNote('colors', c.word, reason));
    }
    if (chroma != null) notes.add(IntentNote('chroma', chroma!.word, reason));
    if (harmony != null) {
      notes.add(IntentNote('harmony', harmonyWords[harmony]!, reason));
    }
    if (hueRange != null) {
      notes.add(
        IntentNote('hueRange', '${hueRange!.$1}–${hueRange!.$2}', reason),
      );
    }
    return notes;
  }
  final def = family.definition;
  final want = effectiveBrightness;
  if (want != null && !brightnessAllowed(def, want)) {
    notes.add(
      IntentNote(
        'brightness',
        want.name,
        want == ThemeBrightness.light
            ? 'dark-only family'
            : 'light-only family',
      ),
    );
  }
  final h = harmony;
  if (h != null) {
    if (family == ThemeFamily.claymorphism) {
      notes.add(
        IntentNote(
          'harmony',
          harmonyWords[h]!,
          'family uses its own colour schemes',
        ),
      );
    } else if (!def.schemes.any((w) => w.value == h && w.weight > 0)) {
      notes.add(
        IntentNote('harmony', harmonyWords[h]!, 'not used by this family'),
      );
    }
  }
  if (family == ThemeFamily.claymorphism) {
    final base = _baseHueRange();
    if (base != null) {
      final checks = want == null ? ThemeBrightness.values : [want];
      final far = checks.every((b) {
        final anchors = b == ThemeBrightness.dark
            ? clayNightBodyHues
            : clayLightBodyHues;
        return clayAnchorFor(anchors, base.$1, base.$2).distance >
            clayAccentFallbackTenths;
      });
      if (far) {
        notes.add(
          IntentNote(
            hueRange != null ? 'hueRange' : 'colors',
            hueRange != null
                ? '${hueRange!.$1}–${hueRange!.$2}'
                : colors.first.word,
            'clay bodies keep their own hues; used for the operators',
          ),
        );
      }
    }
  }
  for (final c in colors.skip(1)) {
    if (c.neutral) {
      notes.add(
        IntentNote('colors', c.word, 'neutrals only quiet the base colour'),
      );
    } else if (h != null) {
      notes.add(
        IntentNote('colors', c.word, 'harmony picks the accent colours'),
      );
    }
  }
  return notes;
}