DrawingML objects

Low-level drawing elements like fill and color that appear repeatedly in various aspects of shapes.

ChartFormat objects

class pptx.dml.chtfmt.ChartFormat(element)[source]

The ChartFormat object provides access to visual shape properties for chart elements like Axis, Series, and MajorGridlines. It has two properties, fill and line, which return a FillFormat and LineFormat object respectively. The ChartFormat object is provided by the format property on the target axis, series, etc.


FillFormat instance for this object, providing access to fill properties such as fill color.


The LineFormat object providing access to the visual properties of this object, such as line color and line style.

FillFormat objects

class pptx.dml.fill.FillFormat(eg_fill_properties_parent, fill_obj)[source]

Provides access to the current fill properties object and provides methods to change the fill type.


Return a ColorFormat object representing background color.

This property is only applicable to pattern fills and lines.


Sets the fill type to noFill, i.e. transparent.


Return a ColorFormat instance representing the foreground color of this fill.


Return member of MSO_PATTERN_TYPE indicating fill pattern.

Raises TypeError when fill is not patterned (call fill.patterned() first). Returns None if no pattern has been set; PowerPoint may display the default PERCENT_5 pattern in this case. Assigning None will remove any explicit pattern setting, although relying on the default behavior is discouraged and may produce rendering differences across client applications.


Selects the pattern fill type.

Note that calling this method does not by itself set a foreground or background color of the pattern. Rather it enables subsequent assignments to properties like fore_color to set the pattern and colors.


Sets the fill type to solid, i.e. a solid color. Note that calling this method does not set a color or by itself cause the shape to appear with a solid color fill; rather it enables subsequent assignments to properties like fore_color to set the color.


Return a value from the MSO_FILL_TYPE enumeration corresponding to the type of this fill.

LineFormat objects

class pptx.dml.line.LineFormat(parent)[source]

Provides access to line properties such as color, style, and width.

A LineFormat object is typically accessed via the .line property of a shape such as Shape or Picture.


The ColorFormat instance that provides access to the color settings for this line. Essentially a shortcut for line.fill.fore_color. As a side-effect, accessing this property causes the line fill type to be set to MSO_FILL.SOLID. If this sounds risky for your use case, use line.fill.type to non-destructively discover the existing fill type.


Return value indicating line style.

Returns a member of MSO_LINE_DASH_STYLE indicating line style, or None if no explicit value has been set. When no explicit value has been set, the line dash style is inherited from the style hierarchy.

Assigning None removes any existing explicitly-defined dash style.


FillFormat instance for this line, providing access to fill properties such as foreground color.


The width of the line expressed as an integer number of English Metric Units. The returned value is an instance of Length, a value class having properties such as .inches, .cm, and .pt for converting the value into convenient units.

ColorFormat objects

class pptx.dml.color.ColorFormat(eg_colorChoice_parent, color)[source]

Provides access to color settings such as RGB color, theme color, and luminance adjustments.


Read/write float value between -1.0 and 1.0 indicating the brightness adjustment for this color, e.g. -0.25 is 25% darker and 0.4 is 40% lighter. 0 means no brightness adjustment.


RGBColor value of this color, or None if no RGB color is explicitly defined for this font. Setting this value to an RGBColor instance causes its type to change to MSO_COLOR_TYPE.RGB. If the color was a theme color with a brightness adjustment, the brightness adjustment is removed when changing it to an RGB color.


Theme color value of this color, one of those defined in the MSO_THEME_COLOR enumeration, e.g. MSO_THEME_COLOR.ACCENT_1. Raises AttributeError on access if the color is not type MSO_COLOR_TYPE.SCHEME. Assigning a value in MSO_THEME_COLOR causes the color’s type to change to MSO_COLOR_TYPE.SCHEME.


Read-only. A value from MSO_COLOR_TYPE, either RGB or SCHEME, corresponding to the way this color is defined, or None if no color is defined at the level of this font.

RGBColor objects

class pptx.dml.color.RGBColor[source]

Immutable value object defining a particular RGB color.

classmethod from_string(rgb_hex_str)[source]

Return a new instance from an RGB color hex string like '3C2F80'.

ShadowFormat objects

class pptx.dml.effect.ShadowFormat(spPr)[source]

Provides access to shadow effect on a shape.


True if shape inherits shadow settings.

Read/write. An explicitly-defined shadow setting on a shape causes this property to return False. A shape with no explicitly-defined shadow setting inherits its shadow settings from the style hierarchy (and so returns True).

Assigning True causes any explicitly-defined shadow setting to be removed and inheritance is restored. Note this has the side-effect of removing all explicitly-defined effects, such as glow and reflection, and restoring inheritance for all effects on the shape. Assigning False causes the inheritance link to be broken and no effects to appear on the shape.