Open
Conversation
Author
|
@scanny this could add value to the repo! Have a go at it, and let me know how you feel about this. |
Seconding that this would add significant value to the project. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Comprehensive Transparency Support to python-pptx
🎯 Overview
This PR adds complete transparency/opacity support to python-pptx, enabling developers to control the transparency of shape fills and colors. The implementation follows the DrawingML specification and provides a clean, intuitive API across all layers of the library.
✨ Features Added
🎨 ColorFormat Transparency
ColorFormat.transparency(read/write, 0.0-1.0 range)0.0= completely opaque (no alpha element in XML)1.0= completely transparent (alpha=0 in XML)0.5= 50% transparent (alpha=50000 in XML)ValueErrorfor values outside 0.0-1.0 rangeValueErrorfor set🎨 FillFormat Transparency
FillFormat.transparency(read/write, 0.0-1.0 range)TypeErrorfor non-solid fill types (gradient, pattern, etc.)🎨 _SolidFill Transparency
_SolidFill.transparency(read/write, 0.0-1.0 range)fore_color.transparency🏗️ Implementation Details
XML Layer (OXML)
<a:alpha>,<a:alphaOff>,<a:alphaMod>CT_PositiveFixedPercentagefor alpha value handling__init__.pyadd_alpha(),clear_alpha()for XML manipulationDomain Model Layer (DML)
🎯 Usage Examples
XML Structure
📝 Notes
Closes #62