fix: support CSS color names in SVG fill and other properties (#1114)#1149
Open
Nikunjvadher wants to merge 1 commit into
Open
fix: support CSS color names in SVG fill and other properties (#1114)#1149Nikunjvadher wants to merge 1 commit into
Nikunjvadher wants to merge 1 commit into
Conversation
- Added a comprehensive mapping of 140+ CSS color names to RGBA values in src/core/color-names.js. - Updated isCol helper to recognize standard color names. - Enhanced convertColorStringValuesToRgbaArray to parse color names into RGBA arrays. - Added specialized automated tests in tests/suites/color-names.test.js. - Updated distribution bundles in dist/ with the new logic. This fixes an issue where SVG animations using color names (like 'red') were ignored when interpolating with other color formats.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1114 by adding comprehensive support for CSS color names (e.g., "red", "blue", "transparent") in animations.
Context
In Anime.js v4, using a color name as an animation value caused a silent failure because the engine did not recognize these strings as valid colors. This prevented them from being interpolated with other color formats like RGBA or Hex.
Changes
isColandconvertColorStringValuesToRgbaArrayto recognize and parse these names.Fixes #1114