I'm not 100% certain that this would work, but theoretically it should solve the issue you're facing. From the python-docx
documentation:
- The
CharacterStyle
class has attributesbase_style
andfont
. - Since the
base_style
object points to anotherCharacterStyle
instance (or None), you can make a "nested" query until you find afont
color.
style = run.stylewhile style: if style.font.color.rgb: color = style.font.color.rgb break else: style = style.base_style