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 Cam16 fromCam = Cam16.fromInt(from);
  final Cam16 toCam = Cam16.fromInt(to);
  final double fromJ = fromCam.jstar;
  final double fromA = fromCam.astar;
  final double fromB = fromCam.bstar;
  final double toJ = toCam.jstar;
  final double toA = toCam.astar;
  final double toB = toCam.bstar;
  final double jstar = fromJ + (toJ - fromJ) * amount;
  final double astar = fromA + (toA - fromA) * amount;
  final double bstar = fromB + (toB - fromB) * amount;
  return Cam16.fromUcs(jstar, astar, bstar).toInt();
}