Skip to content

Color parsing: Fix parsing of 1 / 1.0 / 100%

What does the merge request do?

Closes #402 (closed)

Implementation notes

Current parsing rules:

  • When appending, any float <= 1.0 or percentage is multiplied by 255, while any other value is left as-is.
  • The same holds if the value in the previous bullet point was passed as a string.
  • No restriction is imposed that all three color channels must have the same format (that is, percentage or number).

Summary for release notes

A bug parsing color components of 1 (1.0, 100%) has been fixed. "1.0", 1.0 and "100%" are treated as 255, while "1" and 1 are treated as 1.

Checklist

  • Add unit tests (if applicable)
  • Changes to inkex/ are well documented
  • Clean merge request history
Edited by Jonathan Neuhauser

Merge request reports