Skip to content

harmonize color regex & ignore SVG default black - #327

Open
xerc wants to merge 4 commits into
metafloor:developfrom
xerc:develop
Open

xerc wants to merge 4 commits into
metafloor:developfrom
xerc:develop

Conversation

@xerc

@xerc xerc commented Mar 13, 2024

Copy link
Copy Markdown

found the last one ;)

@xerc xerc changed the title harmonize color regex harmonize color regex & ignore SVG default color(s) Mar 14, 2024
@xerc

xerc commented Mar 14, 2024

Copy link
Copy Markdown
Author

@metafloor do you remember/know if fill-rule="evenodd" is only used for maxicodes inner rings ?

@metafloor

Copy link
Copy Markdown
Owner

All of the drawing in BWIPP uses the postscript default nonzero winding rule. But the filled regions never intersect, so it doesn't have any effect.

@metafloor

Copy link
Copy Markdown
Owner

What are you trying to achieve with testing for white background and path filling? Is it a bug you have found or something else?

@xerc

xerc commented Mar 15, 2024

Copy link
Copy Markdown
Author

after sleeping this would be the best solution to ignore SVG default fill color if it is "black"
could even change the "header" to <svg [..] fill-rule="evenodd" stroke="currentColor" fill="currentColor"> for more flexibility afterwards

@xerc xerc changed the title harmonize color regex & ignore SVG default color(s) harmonize color regex & ignore SVG default black Mar 15, 2024
@metafloor

Copy link
Copy Markdown
Owner

I don't see the need for this and it breaks backward compatibility. Since you won't explain why you want this change, I will assume it's to allow css rules to specify the fill.

If that's the case, just use a regexp to get rid of the fills. Something like:

svg = svg.replace(/ fill="#[0-9A-Fa-f]{6}"/g, '')

A similar approach can be used with stroke color as well.

@xerc

xerc commented Mar 16, 2024

Copy link
Copy Markdown
Author

I don't see the need for this and it breaks backward compatibility. Since you won't explain why you want this change

not shure what to explain ; SVG default color is/was always black

bwt/ the info about currentColor was just a question if you "like" =-> already using replace 4 cleanup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants