scott martin
scott martin

Reputation: 1293

python-pptx - Changing auto shape border color

I am trying to add a colour to the border of a rectangular auto shape that I have created as below. The default colour seems to be blue but I am not sure how could I modify that to a custom color.

shapes = slide.shapes
left = top = width = height = Inches(1.0)
shape = shapes.add_shape(
MSO_SHAPE.ROUNDED_RECTANGLE, left, top, width, height)

fill = shape.fill
fill.solid()
fill.fore_color.rgb = RGBColor(255, 255, 255)

slide.shapes._spTree.remove(shape._element)
slide.shapes._spTree.insert(2, shape._element)

Upvotes: 6

Views: 4983

Answers (1)

scott martin
scott martin

Reputation: 1293

Figured out how to change the auto shape border color using the below:

line = shape.line
line.color.rgb = RGBColor(255, 0, 0)

Upvotes: 10

Related Questions