Home/ Reference/ Color

color.RGBAssign(R, G, B) / color.CMYKAssign(C, M, Y, K)

Changes the components of an existing color in place. No new object — you mutate this one, and every shape referencing it changes along with it.

Signature

color.RGBAssign(R, G, B) / color.CMYKAssign(C, M, Y, K)

Notes

Changes the components of an existing color in place. No new object — you mutate this one, and every shape referencing it changes along with it.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)
c = shape.Fill.UniformColor                         # grab the shape's fill colour object

c.RGBAssign(255, 0, 0)                              # turn it pure red in place
print("After edit: ", c.HexValue)                          # #FF0000

c.CMYKAssign(0, 100, 100, 0)                        # turn it into CMYK red in place
print("CMYK components: ", c.CMYKCyan, c.CMYKMagenta)

About this section: Color

Color — RGB, CMYK and hex color values.

Other entries in this section