I am trying to create a few shapes using python-pptx
module in Python.
I have got the shapes created however I am unable to edit the font color for the text inside shape. By default it displays in white color. I am trying to see how could I change the text color. Given below is what I have built thus far:
left = Inches(1.0)
top = Inches(3.9)
width = Inches(1.2)
height = Inches(2.5)
shape = shapes.add_shape(
MSO_SHAPE.RECTANGLE, left, top, width, height
)
fill = shape.fill
fill.solid()
fill.fore_color.rgb = RGBColor(226, 206, 72) # This RGB code is the background color that I want the shape to be in
fill.fore_color.brightness = -0.3
text_frame = shape.text_frame
text_frame.clear()
p = text_frame.paragraphs[0]
run = p.add_run()
run.text = 'Test message'
font = run.font
font.name = 'Arial'
font.size = Pt(16)
font.bold = True