Add `Chromaticity::with_luminance` to convert chromaticities to colors #224
All Vouch review confidence checks passed
Residual risk 0.06 = Change Risk (0.39) × (1 − Review Confidence (0.83)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 92 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.79 · 3 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.271
Real PR Conversation Timeline
7 items
CI is failing due to cargo rdme. https://github.com/linebender/color/pull/222 should fix that. (And see #chatter > cargo rdme update has CI impacts.)
+1 to this returning OpaqueColor<XyzD65>!
All of the tests are with a luminance of 1.0, so we should add a test that is different:
let chromaticity = Chromaticity { x: 0.25, y: 0.4 };
assert_eq!(
chromaticity.with_luminance(0.2).components,
[0.125, 0.2, 0.175],
);
And maybe one with a luminance of zero.
A small matter of asking for 1-2 more tests...
Approved
Approved these changes.
The import of OpaqueColor here is not needed, I think.
waywardmonkeys
tomcur
Chromaticity plus a luminance encodes a color. Mathematically the most straightforward coming from
xychromaticity is going to XYZ. As all our color spaces are relative to some reference white, this chooses to represent it asXyzD65, i.e., with a reference white of D65 (as that's the most common reference white).The docs note to use
ColorSpace::convert_absoluteto convert this as an absolute color to another color space.