I encountered a TypeError when the library attempts to process styles containing RGBA colors (e.g., rgba(0, 0, 0, 0.65)). The utils.parse_color function appears to return a tuple of 4 values (r, g, b, a), but the RGBColor class is currently defined to only accept r, g, b.
When RGBColor(*colors) is called with a 4-item tuple, it passes 5 arguments to __new__ (cls, r, g, b, a), resulting in a crash because the method signature only expects 4 arguments (cls, r, g, b).
Exception: TypeError('RGBColor.__new__() takes 4 positional arguments but 5 were given')
Steps to Reproduce
-
Parse HTML/content containing a CSS style with an alpha channel, for example: color: rgba(0, 0, 0, 0.65);.
-
The utils.parse_color returns a 4-tuple.
-
The code executes self.run.font.color.rgb = RGBColor(*colors).
-
The application crashes.
Proposed Solution
Modify RGBColor.__new__ to accept variable arguments (*_) so that it can gracefully handle and ignore the Alpha channel (or any extra arguments) while still strictly enforcing the RGB integers.

I encountered a TypeError when the library attempts to process styles containing RGBA colors (e.g., rgba(0, 0, 0, 0.65)). The utils.parse_color function appears to return a tuple of 4 values (r, g, b, a), but the RGBColor class is currently defined to only accept r, g, b.
When RGBColor(*colors) is called with a 4-item tuple, it passes 5 arguments to
__new__(cls, r, g, b, a), resulting in a crash because the method signature only expects 4 arguments (cls, r, g, b).Steps to Reproduce
Parse HTML/content containing a CSS style with an alpha channel, for example: color: rgba(0, 0, 0, 0.65);.
The utils.parse_color returns a 4-tuple.
The code executes self.run.font.color.rgb = RGBColor(*colors).
The application crashes.
Proposed Solution
Modify
RGBColor.__new__to accept variable arguments (*_) so that it can gracefully handle and ignore the Alpha channel (or any extra arguments) while still strictly enforcing the RGB integers.