softRimFor function

int softRimFor(
  1. int surface, {
  2. double target = ratioLarge,
})

The rim colour for surface: same hue, chroma + 0.01, the least lightness change from the surface that reaches target against it.

Implementation

int softRimFor(int surface, {double target = ratioLarge}) {
  final s = argbToOklch(surface);
  final dark = luminanceArgb(surface) < yEqualContrast;
  return solveLightness(
        l0: s.l,
        c: s.c + 0.01,
        hDeg: s.h,
        againstArgb: surface,
        target: target,
        preferLighter: dark,
      ) ??
      blackOrWhite(surface);
}