fix: lerp colors in current color mode#8920
Conversation
Continuous ReleaseCDN linkPublished PackagesCommit hash: 10cf56d Previous deploymentsThis is an automated message. |
|
Thanks for taking a look at this. I checked the current failing CI job. The only failing test I found is in For the color-related change, I verified the affected tests locally:
One clarification on the test diff: I did not add a new regression test, but the existing HSL/HSB If you would prefer a source-only PR first, I can adjust the test changes based on your preference. |
10cf56d to
3141502
Compare
|
|
||
| assert.closeTo(interA._color.coords[0], 37, 1); | ||
| assert.closeTo(interA._color.coords[1], 43, 1); | ||
| assert.closeTo(interA._color.coords[0], 352, 1); |
There was a problem hiding this comment.
Why have the RGB test cases changed?
There was a problem hiding this comment.
It looks like it's just HSL tests that have modifications here, and the one RGB test in between these if you expand some of the code diffs is unmodified. So it might be ok!
There was a problem hiding this comment.
Thanks for checking this.
The RGB test between these cases was not changed. The changed expectations are for the HSL/HSB lerpColor() cases, because those existing assertions were encoding the old behavior where interpolation still happened through RGB space.
After the fix, those cases now interpolate in the active color mode, so the expected channel values changed. I agree the diff can look confusing because the unchanged RGB case sits between the modified cases.
3141502 to
a2193b2
Compare
Resolves #8883
Changes:
Color.lerp()interpolate in the explicit mode passed bylerpColor(), instead of interpolating in the source colors' original color space and only formatting the result in the current mode.lerpColor()expectations to match current-mode interpolation. I did not add a new regression test, following the maintainer request in [p5.js 2.0+ Bug Report]:lerpColor()not affected bycolorMode()#8883 to start with just the fix.Screenshots of the change:
Not applicable.
PR Checklist
npm run lintpassesVerification:
npm test -- --run test/unit/color/creating_reading.js test/unit/color/p5.Color.jsnpm run lintAI assistance disclosure: I used Codex assistively while preparing this change. I reviewed the issue discussion, source changes, test updates, and verification output myself, and I take responsibility for the PR.