5

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)
scott martin
  • 1,253
  • 1
  • 14
  • 36
  • The doc [here](https://python-pptx.readthedocs.io/en/latest/user/autoshapes.html#line) has the info OP wants. – jdhao Dec 01 '20 at 06:50

1 Answers1

7

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

line = shape.line
line.color.rgb = RGBColor(255, 0, 0)
scott martin
  • 1,253
  • 1
  • 14
  • 36