I have not been able to find a straight forward answer to this, and it should be relatively simple:
Using python-pptx, I am trying to read the color of the font of the text inside a textbox on a slide.
I am not trying to change the color of the text but rather I am reading in a PowerPoint slide and I can access the text, shape, end points etc., but I also need to access the font color.
Currently I am trying:
for shape in slide.shapes:
if shape.has_text_frame:
text = shape.text_frame.text
if shape.shape_type == 17:
try:
text_color = shape.text_frame.paragraphs[0].font.color.rgb
except AttributeError:
fill_color = None
else:
text_color = None
but its giving an Attribute Error: no .rgb property on color type '_NoneColor'
The font belongs to a run. So paragraphs[0].runs[0]
should get you to the font object.