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.


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


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


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 line color, style, and width. 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.


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'.