Skip to content
This repository has been archived by the owner on Oct 30, 2021. It is now read-only.

currentColor is invalid color? #242

Open
kubiqsk opened this issue Jul 7, 2021 · 3 comments
Open

currentColor is invalid color? #242

kubiqsk opened this issue Jul 7, 2021 · 3 comments

Comments

@kubiqsk
Copy link

kubiqsk commented Jul 7, 2021

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
Copy link
Owner

RazrFalcon commented Jul 7, 2021

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
Copy link
Author

kubiqsk commented Jul 7, 2021

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
Copy link
Owner

RazrFalcon commented Jul 7, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants