hctFromUv function
Hct
hctFromUv(
- double tone,
- double uvHue,
- double uvChroma, {
- ColorModel model = ColorModel.kDefault,
Color at tone whose chromaticity sits uvChroma from the white point
in direction uvHue (degrees), clamped to the sRGB gamut.
Implementation
Hct hctFromUv(
double tone,
double uvHue,
double uvChroma, {
ColorModel model = ColorModel.kDefault,
}) {
final (wu, wv) = whiteUvPoint;
final radians = uvHue * math.pi / 180.0;
final slice = SliceCache.of(tone);
final result = slice.nearest(
wu + uvChroma * math.cos(radians),
wv + uvChroma * math.sin(radians),
);
final retoned = Hct.from(result.hue, result.chroma, tone.clamp(0.0, 100.0));
return Hct.fromInt(retoned.toInt(), model: model);
}