Skip to content

Conversation

@dfop02
Copy link
Owner

@dfop02 dfop02 commented Dec 10, 2025

Description

I refactored the entire color parsing logic to make it more robust and prevent issues caused by invalid values. The parser now always falls back to black if something goes wrong, and it logs a warning for the user.

This update also fixes crashes that occurred when attempting to parse RGBA colors, which are not supported by python-docx.
Additional logs were added to inform the user that RGBA is unsupported and that opacity values will be ignored.

Issue Reference

Fixes #53

Checklist Before Requesting a Review

  • I have performed a self-review of my code.
  • My code follows the project's coding style and guidelines.
  • I have run tests and verified that all existing and new tests pass.
  • I have added new tests to cover my changes.

@dfop02 dfop02 self-assigned this Dec 10, 2025
@dfop02 dfop02 added the bug Something isn't working label Dec 15, 2025
@dfop02 dfop02 merged commit a508c3c into main Dec 15, 2025
6 of 12 checks passed
@dfop02 dfop02 deleted the bug/fix-rgba-error branch December 15, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: RGBColor.__new__() crashes when parsing RGBA colors

2 participants