chromaMax = tidy.tidy(
[],
tidy.expand({
space: Array.from(colorUtils.mapColorSpaces().values()),
hex: ["#0000FF", "#00FF00", "#00FFFF", "#FF0000", "#FF00FF", "#FFFF00"],
condition: ["none", "protan", "deuteran", "tritan"]
}),
tidy.mutate({
sRgb: (d) => colorUtils.hexToSRgb(d.hex),
sRgbCvd: (d) =>
_.flow([
colorUtils.linearRgbFromSRgb,
(x) => math.multiply(matrixCvd(d.condition, 1), x),
colorUtils.clampRgbGamut,
colorUtils.linearRgbToSRgb
])(d.sRgb),
space100Cvd: (d) =>
_.flow([colorSpaces[d.space].fromSRgb, colorSpaces[d.space].to100])(
d.sRgbCvd
),
chroma: (d) => math.distance([0, 0], d.space100Cvd.slice(1))
}),
tidy.groupBy("space", [
tidy.summarize({
chroma: tidy.max("chroma")
})
])
)