Repository navigation
Read hsl() hues that have a CSS angle unit - #543
Conversation
|
Thanks, I confirmed the bug on The new test fails in CI, though, so the PR can't merge as it stands. Four of its cases use the space-separated syntax ( Please remove the space-separated cases from the test and from the description, and keep the comma-separated ones. Supporting the space-separated (and The branch also conflicts with |
412412f to
626e520
Compare
|
Thanks for checking. I removed the space-separated cases from the test and kept the comma-separated ones, merged main into the branch, and updated the description. pytest, ruff and mypy pass. |
|
|
fill="hsl(120deg, 100%, 50%)"is drawn black instead of green, with no warning. ReportLab'scssParse()reads the hue ofhsl()as a plain number and raisesValueError: bad hue argument value '120deg', and the shape falls back to the default fill.CSS Color 4 (§7) allows the hue to be an angle:
deg,grad,radorturn.convertColor()now converts such a hue to degrees before callingcssParse(), sohsl(120deg 100% 50%),hsl(0.5turn ...),hsl(200grad ...)andhsla(240deg, ...)give the expected colors. A hue without a unit is unchanged.Added
test_hsl_hue_with_angle_unit; it fails on main. Updatedtests/public_api.jsonwith--updatefor the two new private names, and added a### Fixedentry inCHANGELOG.md(I used #543, I'll fix it if the PR gets another number).pytest,ruff format --check,ruff checkandmypy src testspass.AI-assisted (Claude Code); I reviewed and tested the change