comicInkOn function

Color comicInkOn(
  1. Color ground,
  2. Color wanted,
  3. Iterable<Color> inks
)

Letters drawn on a face of their own (an avatar's), which keeps its own fill where a filled ground around it rescopes the theme's inks: wanted when it reads 4.5:1 on ground, else whichever of inks reads best there.

Implementation

Color comicInkOn(Color ground, Color wanted, Iterable<Color> inks) {
  if (_contrast(wanted, ground) >= 4.5) return wanted;
  var best = wanted;
  for (final ink in inks) {
    if (_contrast(ink, ground) > _contrast(best, ground)) best = ink;
  }
  return best;
}