Skip to content

Read the CSS named colors that ReportLab lacks or defines differently - #542

Merged
deeplook merged 1 commit into
deeplook:mainfrom
RavSinghChandan:css-named-colors
Nov 9, 2026
Merged

deeplook merged 1 commit into
deeplook:mainfrom
RavSinghChandan:css-named-colors

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

Comparing ReportLab's named colors with the CSS list (148 names, from tinycss2), three differ:

  • rebeccapurple (#663399, CSS Color 4) and lightgray (#d3d3d3; ReportLab only has lightgrey) are missing, so fill="rebeccapurple" leaves the shape without a fill and logs Can't handle color.
  • darkseagreen is #8fbc8b in ReportLab but #8fbc8f in CSS.

convertColor() now looks these three up in a small _CSS_NAMED_COLORS table before falling back to ReportLab's colors. I didn't use tinycss2.color4 for this because svglib still allows tinycss2 0.6, which doesn't have it.

Added test_css_named_colors_missing_in_reportlab; it fails on main. Updated tests/public_api.json with --update for the new private name, and added a ### Fixed entry in CHANGELOG.md (I used #542, I'll fix it if the PR gets another number). pytest, ruff format --check, ruff check and mypy src tests pass.

AI-assisted (Claude Code); I reviewed and tested the change

@deeplook
deeplook merged commit 079d7ed into deeplook:main Nov 9, 2026
16 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