feat(convertColors): add excludeMulticolor option to exclude multicolor icons#2165
feat(convertColors): add excludeMulticolor option to exclude multicolor icons#2165chip-cmyk wants to merge 2 commits into
Conversation
|
Hey hey! Thanks for contributing this! Before I review it, would you be willing to chime in on #1673? I was actually thinking about freezing/deprecating the Usually making editorial decisions in this way isn't going to yield desirable results, it's just an inefficient and less predictable way to amend the source, with longer iterations between changes. I was learning towards deprecating instead of expanding the options to support more use cases, because so far, no one has offered more insight on why we should keep this. The reason it was added (it was hard to override colors in CSS in some clients) is no longer applicable either. As SVGO is not an SVG editing tool, I think I'd rather keep things simple, and direct users to either hand-edit their SVG, use an actual editor, use an XML library, or a custom SVGO plugin. I wouldn't mind even writing blog-esk guides for this on our website. But I don't think SVGO should support scenarios like this. I'd love more insight though, if you believe that using this SVGO plugin is actually better than doing it in your vector editor or by hand-editing it, feel free to share! TL;DR: Imo, rather than adding more maintenance/complexity to the |
|
Thank you for the detailed explanation! I've read #1673 regarding the potential issues with In our project, this feature has been very helpful in solving a specific problem. We're working with many Figma-exported icons that need to adapt to different themes through CSS color control, similar to text styling. At first, I found that setting I've tried other approaches like using If you still prefer to remove this feature, I completely understand. Could you share your thoughts on alternative approach for similar requirements? Before submitting this PR, I actually implemented similar functionality through a custom SVGO plugin. However, I found it difficult to access some internal methods like
|

Description
When using the
convertColorsplugin withcurrentColorconfiguration, I found that multi-color icons were also being converted tocurrentColor, making them appear as single-color in actual use. I wanted to preserve the colors of multi-color icons while only converting single-color icons tocurrentColor. I discovered issue #1302 describing the same problem, so I tried adding parameter configuration to differentiate between multi-color and single-color icons.New Parameters
value: Specifies target colors for conversion (boolean, string, or RegExp)excludeMulticolor: When set totrue, excludes conversion on multi-color and gradient iconsUsage Examples