11from typing import Literal , Self
22
33from pptx .enum .dml import MSO_COLOR_TYPE , MSO_THEME_COLOR , MSO_THEME_COLOR_INDEX
4- from pptx .oxml .dml .color import CT_Color , CT_SRgbColor , _BaseColorElement
4+ from pptx .oxml .dml .color import (
5+ CT_Color ,
6+ CT_HslColor ,
7+ CT_PresetColor ,
8+ CT_SchemeColor ,
9+ CT_ScRgbColor ,
10+ CT_SRgbColor ,
11+ CT_SystemColor ,
12+ )
13+
14+ type ColorElement = CT_HslColor | CT_PresetColor | CT_SchemeColor | CT_ScRgbColor | CT_ScRgbColor | CT_SystemColor
515
616class ColorFormat :
7- """
8- Provides access to color settings such as RGB color, theme color, and
9- luminance adjustments.
10- """
17+ _xFill : CT_Color
18+ _color : _Color
1119 def __init__ (self , eg_colorChoice_parent : CT_Color , color : _Color ) -> None : ...
1220 @property
13- def brightness (self ) -> float :
14- """
15- Read/write float value between -1.0 and 1.0 indicating the brightness
16- adjustment for this color, e.g. -0.25 is 25% darker and 0.4 is 40%
17- lighter. 0 means no brightness adjustment.
18- """
19- ...
20-
21+ def brightness (self ) -> float : ...
2122 @brightness .setter
2223 def brightness (self , value : float ) -> None : ...
2324 @classmethod
2425 def from_colorchoice_parent (cls , eg_colorChoice_parent : CT_Color ) -> Self : ...
2526 @property
26- def rgb (self ) -> RGBColor :
27- """
28- |RGBColor| value of this color, or None if no RGB color is explicitly
29- defined for this font. Setting this value to an |RGBColor| instance
30- causes its type to change to MSO_COLOR_TYPE.RGB. If the color was a
31- theme color with a brightness adjustment, the brightness adjustment
32- is removed when changing it to an RGB color.
33- """
34- ...
35-
27+ def rgb (self ) -> RGBColor : ...
3628 @rgb .setter
3729 def rgb (self , rgb : RGBColor ) -> None : ...
3830 @property
39- def theme_color (self ) -> MSO_THEME_COLOR_INDEX :
40- """Theme color value of this color.
41-
42- Value is a member of :ref:`MsoThemeColorIndex`, e.g.
43- ``MSO_THEME_COLOR.ACCENT_1``. Raises AttributeError on access if the
44- color is not type ``MSO_COLOR_TYPE.SCHEME``. Assigning a member of
45- :ref:`MsoThemeColorIndex` causes the color's type to change to
46- ``MSO_COLOR_TYPE.SCHEME``.
47- """
48- ...
49-
31+ def theme_color (self ) -> MSO_THEME_COLOR_INDEX : ...
5032 @theme_color .setter
5133 def theme_color (self , mso_theme_color_idx : MSO_THEME_COLOR_INDEX ) -> None : ...
5234 @property
53- def type (self ) -> MSO_COLOR_TYPE :
54- """
55- Read-only. A value from :ref:`MsoColorType`, either RGB or SCHEME,
56- corresponding to the way this color is defined, or None if no color
57- is defined at the level of this font.
58- """
59- ...
35+ def type (self ) -> MSO_COLOR_TYPE : ...
6036
6137class _Color :
62- """
63- Object factory for color object of the appropriate type, also the base
64- class for all color type classes such as SRgbColor.
65- """
66- def __new__ (cls , xClr : _BaseColorElement | None ) -> Self : ...
67- def __init__ (self , xClr : _BaseColorElement | None ) -> None : ...
38+ _xclr : ColorElement
39+ def __new__ (cls , xClr : ColorElement | None ) -> Self : ...
40+ def __init__ (self , xClr : ColorElement | None ) -> None : ...
6841 @property
6942 def brightness (self ) -> float : ...
7043 @brightness .setter
7144 def brightness (self , value : float ) -> None : ...
7245 @property
7346 def color_type (self ) -> MSO_COLOR_TYPE : ...
7447 @property
75- def rgb (self ) -> RGBColor :
76- """
77- Raises TypeError on access unless overridden by subclass.
78- """
79- ...
80-
48+ def rgb (self ) -> RGBColor : ...
8149 @property
82- def theme_color (self ) -> Literal [MSO_THEME_COLOR_INDEX .NOT_THEME_COLOR ]:
83- """
84- Raises TypeError on access unless overridden by subclass.
85- """
86- ...
50+ def theme_color (self ) -> Literal [MSO_THEME_COLOR_INDEX .NOT_THEME_COLOR ]: ...
51+ def _shade (self , value : float ): ...
52+ def _tint (self , value : float ): ...
8753
8854class _HslColor (_Color ):
8955 @property
@@ -93,12 +59,7 @@ class _NoneColor(_Color):
9359 @property
9460 def color_type (self ) -> None : ...
9561 @property
96- def theme_color (self ):
97- """
98- Raise TypeError on attempt to access .theme_color when no color
99- choice is present.
100- """
101- ...
62+ def theme_color (self ): ...
10263
10364class _PrstColor (_Color ):
10465 @property
@@ -109,16 +70,7 @@ class _SchemeColor(_Color):
10970 @property
11071 def color_type (self ) -> Literal [MSO_COLOR_TYPE .SCHEME ]: ...
11172 @property
112- def theme_color (self ) -> MSO_THEME_COLOR | None :
113- """
114- Theme color value of this color, one of those defined in the
115- MSO_THEME_COLOR enumeration, e.g. MSO_THEME_COLOR.ACCENT_1. None if
116- no theme color is explicitly defined for this font. Setting this to a
117- value in MSO_THEME_COLOR causes the color's type to change to
118- ``MSO_COLOR_TYPE.SCHEME``.
119- """
120- ...
121-
73+ def theme_color (self ) -> MSO_THEME_COLOR | None : ...
12274 @theme_color .setter
12375 def theme_color (self , mso_theme_color_idx : MSO_THEME_COLOR ) -> None : ...
12476
@@ -131,13 +83,7 @@ class _SRgbColor(_Color):
13183 @property
13284 def color_type (self ) -> Literal [MSO_COLOR_TYPE .RGB ]: ...
13385 @property
134- def rgb (self ) -> RGBColor :
135- """
136- |RGBColor| value of this color, corresponding to the value in the
137- required ``val`` attribute of the ``<a:srgbColr>`` element.
138- """
139- ...
140-
86+ def rgb (self ) -> RGBColor : ...
14187 @rgb .setter
14288 def rgb (self , rgb ) -> None : ...
14389
@@ -146,19 +92,7 @@ class _SysColor(_Color):
14692 def color_type (self ) -> Literal [MSO_COLOR_TYPE .SYSTEM ]: ...
14793
14894class RGBColor (tuple [int , int , int ]):
149- """
150- Immutable value object defining a particular RGB color.
151- """
15295 def __new__ (cls , r : int , g : int , b : int ) -> Self : ...
153- def __str__ (self ) -> str :
154- """
155- Return a hex string rgb value, like '3C2F80'
156- """
157- ...
158-
96+ def __str__ (self ) -> str : ...
15997 @classmethod
160- def from_string (cls , rgb_hex_str : str ) -> Self :
161- """
162- Return a new instance from an RGB color hex string like ``'3C2F80'``.
163- """
164- ...
98+ def from_string (cls , rgb_hex_str : str ) -> Self : ...
0 commit comments