inViewingConditions method
Implementation
Hct inViewingConditions(ViewingConditions vc) {
// 1. Use CAM16 to find XYZ coordinates of color in specified VC.
final cam16 = Cam16.fromInt(toInt());
final viewedInVc = cam16.xyzInViewingConditions(vc);
// 2. Create CAM16 of those XYZ coordinates in default VC.
final recastInVc = Cam16.fromXyzInViewingConditions(
viewedInVc[0],
viewedInVc[1],
viewedInVc[2],
ViewingConditions.sRgb,
);
// 3. Create HCT from:
// - CAM16 using default VC with XYZ coordinates in specified VC.
// - L* converted from Y in XYZ coordinates in specified VC.
return .from(
recastInVc.hue,
recastInVc.chroma,
ColorUtils.lstarFromY(viewedInVc[1]),
);
}