66
77
88class ColorFormat (ElementProxy ):
9- """
10- Provides access to color settings such as RGB color, theme color, and
11- luminance adjustments.
12- """
9+ """Provides access to color settings such as RGB color, theme color, and luminance
10+ adjustments."""
1311
1412 __slots__ = ()
1513
@@ -18,22 +16,19 @@ def __init__(self, rPr_parent):
1816
1917 @property
2018 def rgb (self ):
21- """
22- An |RGBColor| value or |None| if no RGB color is specified.
23-
24- When :attr:`type` is `MSO_COLOR_TYPE.RGB`, the value of this property
25- will always be an |RGBColor| value. It may also be an |RGBColor|
26- value if :attr:`type` is `MSO_COLOR_TYPE.THEME`, as Word writes the
27- current value of a theme color when one is assigned. In that case,
28- the RGB value should be interpreted as no more than a good guess
29- however, as the theme color takes precedence at rendering time. Its
30- value is |None| whenever :attr:`type` is either |None| or
31- `MSO_COLOR_TYPE.AUTO`.
32-
33- Assigning an |RGBColor| value causes :attr:`type` to become
34- `MSO_COLOR_TYPE.RGB` and any theme color is removed. Assigning |None|
35- causes any color to be removed such that the effective color is
36- inherited from the style hierarchy.
19+ """An |RGBColor| value or |None| if no RGB color is specified.
20+
21+ When :attr:`type` is `MSO_COLOR_TYPE.RGB`, the value of this property will
22+ always be an |RGBColor| value. It may also be an |RGBColor| value if
23+ :attr:`type` is `MSO_COLOR_TYPE.THEME`, as Word writes the current value of a
24+ theme color when one is assigned. In that case, the RGB value should be
25+ interpreted as no more than a good guess however, as the theme color takes
26+ precedence at rendering time. Its value is |None| whenever :attr:`type` is
27+ either |None| or `MSO_COLOR_TYPE.AUTO`.
28+
29+ Assigning an |RGBColor| value causes :attr:`type` to become `MSO_COLOR_TYPE.RGB`
30+ and any theme color is removed. Assigning |None| causes any color to be removed
31+ such that the effective color is inherited from the style hierarchy.
3732 """
3833 color = self ._color
3934 if color is None :
@@ -53,18 +48,16 @@ def rgb(self, value):
5348
5449 @property
5550 def theme_color (self ):
56- """
57- A member of :ref:`MsoThemeColorIndex` or |None| if no theme color is
58- specified. When :attr:`type` is `MSO_COLOR_TYPE.THEME`, the value of
59- this property will always be a member of :ref:`MsoThemeColorIndex`.
60- When :attr:`type` has any other value, the value of this property is
61- |None|.
62-
63- Assigning a member of :ref:`MsoThemeColorIndex` causes :attr:`type`
64- to become `MSO_COLOR_TYPE.THEME`. Any existing RGB value is retained
65- but ignored by Word. Assigning |None| causes any color specification
66- to be removed such that the effective color is inherited from the
67- style hierarchy.
51+ """Member of :ref:`MsoThemeColorIndex` or |None| if no theme color is specified.
52+
53+ When :attr:`type` is `MSO_COLOR_TYPE.THEME`, the value of this property will
54+ always be a member of :ref:`MsoThemeColorIndex`. When :attr:`type` has any other
55+ value, the value of this property is |None|.
56+
57+ Assigning a member of :ref:`MsoThemeColorIndex` causes :attr:`type` to become
58+ `MSO_COLOR_TYPE.THEME`. Any existing RGB value is retained but ignored by Word.
59+ Assigning |None| causes any color specification to be removed such that the
60+ effective color is inherited from the style hierarchy.
6861 """
6962 color = self ._color
7063 if color is None or color .themeColor is None :
@@ -80,12 +73,13 @@ def theme_color(self, value):
8073 self ._element .get_or_add_rPr ().get_or_add_color ().themeColor = value
8174
8275 @property
83- def type (self ):
84- """
85- Read-only. A member of :ref:`MsoColorType`, one of RGB, THEME, or
86- AUTO, corresponding to the way this color is defined. Its value is
87- |None| if no color is applied at this level, which causes the
88- effective color to be inherited from the style hierarchy.
76+ def type (self ) -> MSO_COLOR_TYPE :
77+ """Read-only.
78+
79+ A member of :ref:`MsoColorType`, one of RGB, THEME, or AUTO, corresponding to
80+ the way this color is defined. Its value is |None| if no color is applied at
81+ this level, which causes the effective color to be inherited from the style
82+ hierarchy.
8983 """
9084 color = self ._color
9185 if color is None :
@@ -98,9 +92,9 @@ def type(self):
9892
9993 @property
10094 def _color (self ):
101- """
102- Return `w:rPr/w:color` or |None| if not present. Helper to factor out
103- repetitive element access.
95+ """Return `w:rPr/w:color` or |None| if not present.
96+
97+ Helper to factor out repetitive element access.
10498 """
10599 rPr = self ._element .rPr
106100 if rPr is None :
0 commit comments