clayHighlightAlphaFor function
The highlight alpha the renderer actually paints on face (and the
guardrail checks): the Palette.highlight alpha × 1.0 (face L ≥ 0.80),
0.75 (≥ 0.62), 0.55 (≥ 0.40) or 0.35 (darker, e.g. a night pillow).
Implementation
int clayHighlightAlphaFor(int face, int highlight) {
final l = _lightness(face);
final permille = l >= 0.80
? 1000
: l >= 0.62
? 750
: l >= 0.40
? 550
: 350;
final a = (highlight >>> 24) & 0xFF;
return (a * permille + 500) ~/ 1000;
}