Skip to content

SVG: read currentColor and inherit regardless of case - #2160

Merged
andersonhc merged 2 commits into
py-pdf:masterfrom
RavSinghChandan:svg-currentcolor-case
Nov 10, 2026
Merged

andersonhc merged 2 commits into
py-pdf:masterfrom
RavSinghChandan:svg-currentcolor-case

Conversation

@RavSinghChandan

Copy link
Copy Markdown

fill="currentcolor" fails with ValueError: unsupported color specification currentcolor, because inheritable() only recognizes the exact spelling currentColor. CSS keywords are case-insensitive, and svgcolor() already reads color names regardless of case. The Font Awesome icons that WordPress sharing plugins put in web pages are written fill="currentcolor" (several pages in trafilatura's and htmldate's test sets have them).

inheritable() now compares inherit and currentColor regardless of case and surrounding spaces; non-string values pass through to the converter as before.

Added two cases to test_svg_attribute_conversion; they fail on master. The full test suite passes except test_image_with_explicit_dimensions, which also fails on master in my environment; black, pylint, mypy and pyright pass

@andersonhc
andersonhc merged commit 1030854 into py-pdf:master Nov 10, 2026
23 checks passed
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