I am working with python docx and here I am stuck.
from docx import Document
document = Document()
run = document.add_paragraph().add_run()
font = run.font
from docx.shared import RGBColor
font.color.rgb = RGBColor(0x42, 0x24, 0xE9)
The three parameters to RGBColor are just integers, so:
RGBColor(66, 36, 233)
Produces the same results as:
RGBColor(0x42, 0x24, 0xE9)
0x prefix is just a way of telling Python that what follows is to be interpreted as a base-16 number. It doesn't have to do with python-docx per se; any way you get an integer between 0 and 255 into those three positions will work fine.