fix(animation): strip CSS comments from color strings before interpolation by jonathan-fulton · Pull Request #12189 · chartjs/Chart.js
Summary
Fixes #12079
When color strings contain CSS-style comments (e.g., rgba(255, 0, 0 /* red */, 0.5)), the color interpolation during animation would fail because the color helper couldn't parse the commented string.
Changes
- Added
stripCssCommentshelper function to remove/* ... */style comments from color strings - Applied the stripping before passing colors to the color interpolation functions
Use Case
Some users document their colors inline using CSS comments, which is valid CSS but wasn't being handled by Chart.js's animation system:
backgroundColor: 'rgba(255, 0, 0 /* red */, 0.5)'This fix ensures such colors can still be animated properly.