cam16Ucs static method

int cam16Ucs(
  1. int from,
  2. int to,
  3. double amount
)

Blend in CAM16-UCS space.

from ARGB representation of color to ARGB representation of color amount how much blending to perform; 0.0 >= and <= 1.0 Returns from, blended towards to. Hue, chroma, and tone will change.

Implementation

static int cam16Ucs(int from, int to, double amount) {
  final fromCam = Cam16.fromInt(from);
  final toCam = Cam16.fromInt(to);
  final fromJ = fromCam.jstar;
  final fromA = fromCam.astar;
  final fromB = fromCam.bstar;
  final toJ = toCam.jstar;
  final toA = toCam.astar;
  final toB = toCam.bstar;
  final jstar = fromJ + (toJ - fromJ) * amount;
  final astar = fromA + (toA - fromA) * amount;
  final bstar = fromB + (toB - fromB) * amount;
  return Cam16.fromUcs(jstar, astar, bstar).toInt();
}