RazrFalcon / svgcleaner

svgcleaner could help you to clean up your SVG files from the unnecessary data.
GNU General Public License v2.0
1.62k stars 93 forks source link

currentColor is invalid color? #242

Open kubiqsk opened 3 years ago

kubiqsk commented 3 years ago

currentColor is one of the most used colors in web SVGs, it's definitely not invalid color, so please allow this

Thank you for a great app

RazrFalcon commented 3 years ago

Only an external currentColor is not supported. svgcleaner has no way of knowing it. In theory, we could try preserving it, but it is complicated.

kubiqsk commented 3 years ago

It doesn't need any context, it's like CSS variable and it's working everywhere https://caniuse.com/?search=currentColor

currentColor is applied from the closest parent element which has some color

so when you use SVG on web eg. for icons in buttons, then it should load color from button text and on hover (mouseover) it should change with text color

next usecase is switching color themes etc... there are many scenarios like that

your validator should just skip this, ignore it or maybe you have some whitelist there? I didn't really investigate your source code

RazrFalcon commented 3 years ago

As I've said, this is not supported and hard to implement. svgcleaner is designed for self-contained SVGs.