-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In a HTML table, bgcolor is affecting text colour #512
Comments
Hi @dmail00! Thank you for reporting this bug, and for the detailed error report! Your fix was functional, but I think that instead of a call to the private method self.pdf.set_fill_color(*fill_color.colors) Would you like to submit a PR fixing this issue, including a short unit test? |
@all-contributors please add @dmail00 for bug |
I've put up a pull request to add @dmail00! 🎉 |
This has been released in v2.5.7 |
Describe the bug
In a table bgcolor is affecting text colour.
Error details
The background is being set at [1] using box_shadow, and box_shadow [2] is getting the current fill colour changing it and then resetting it. However, set_fill_colour does more [3] as shown below, so just caching and reseting the colour is not enough
As a hack I changed shadow_box to the following and it is rendered correctly:
[1] https://github.com/PyFPDF/fpdf2/blob/master/fpdf/html.py#L347
[2] https://github.com/PyFPDF/fpdf2/blob/d840cf16ad0199a53d507f905d6d19d139a2147b/fpdf/html.py#L396
[3] https://github.com/PyFPDF/fpdf2/blob/d840cf16ad0199a53d507f905d6d19d139a2147b/fpdf/fpdf.py#L961
Minimal code
Please include some minimal Python code reproducing your issue:
If you don't know how to build a minimal reproducible example, please check this tutorial: https://stackoverflow.com/help/minimal-reproducible-example
Environment
fpdf2
version used 2.5.6Side note: During looking at this, I noticed that I can not set a border for cells that is respected, but that is a seperate issue.
The text was updated successfully, but these errors were encountered: