Provides access to the current fill properties. Also provides methods to change the fill type.
| 25 | |
| 26 | |
| 27 | class FillFormat(object): |
| 28 | """Provides access to the current fill properties. |
| 29 | |
| 30 | Also provides methods to change the fill type. |
| 31 | """ |
| 32 | |
| 33 | def __init__(self, eg_fill_properties_parent: BaseOxmlElement, fill_obj: _Fill): |
| 34 | super(FillFormat, self).__init__() |
| 35 | self._xPr = eg_fill_properties_parent |
| 36 | self._fill = fill_obj |
| 37 | |
| 38 | @classmethod |
| 39 | def from_fill_parent(cls, eg_fillProperties_parent: BaseOxmlElement) -> FillFormat: |
| 40 | """ |
| 41 | Return a |FillFormat| instance initialized to the settings contained |
| 42 | in *eg_fillProperties_parent*, which must be an element having |
| 43 | EG_FillProperties in its child element sequence in the XML schema. |
| 44 | """ |
| 45 | fill_elm = eg_fillProperties_parent.eg_fillProperties |
| 46 | fill = _Fill(fill_elm) |
| 47 | fill_format = cls(eg_fillProperties_parent, fill) |
| 48 | return fill_format |
| 49 | |
| 50 | @property |
| 51 | def back_color(self): |
| 52 | """Return a |ColorFormat| object representing background color. |
| 53 | |
| 54 | This property is only applicable to pattern fills and lines. |
| 55 | """ |
| 56 | return self._fill.back_color |
| 57 | |
| 58 | def background(self): |
| 59 | """ |
| 60 | Sets the fill type to noFill, i.e. transparent. |
| 61 | """ |
| 62 | noFill = self._xPr.get_or_change_to_noFill() |
| 63 | self._fill = _NoFill(noFill) |
| 64 | |
| 65 | @property |
| 66 | def fore_color(self): |
| 67 | """ |
| 68 | Return a |ColorFormat| instance representing the foreground color of |
| 69 | this fill. |
| 70 | """ |
| 71 | return self._fill.fore_color |
| 72 | |
| 73 | def gradient(self): |
| 74 | """Sets the fill type to gradient. |
| 75 | |
| 76 | If the fill is not already a gradient, a default gradient is added. |
| 77 | The default gradient corresponds to the default in the built-in |
| 78 | PowerPoint "White" template. This gradient is linear at angle |
| 79 | 90-degrees (upward), with two stops. The first stop is Accent-1 with |
| 80 | tint 100%, shade 100%, and satMod 130%. The second stop is Accent-1 |
| 81 | with tint 50%, shade 100%, and satMod 350%. |
| 82 | """ |
| 83 | gradFill = self._xPr.get_or_change_to_gradFill() |
| 84 | self._fill = _GradFill(gradFill) |
no outgoing calls
searching dependent graphs…