Home/ Reference/ Fill

shape.Fill.UniformColor

The color object behind a uniform fill. Requires Fill.Type == 1, otherwise access raises.

Signature

shape.Fill.UniformColor

Notes

The color object behind a uniform fill. Requires Fill.Type == 1, otherwise access raises.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)

if shape.Fill.Type != 1:
    print("Not a uniform fill; set a colour first")
    shape.Fill.UniformColor.RGBAssign(0, 0, 0)   # after assigning, the type reports 1

color = shape.Fill.UniformColor                   # color : a uniform colour object
print("Hex:", color.HexValue)

About this section: Fill

Fill — uniform, gradient and pattern fills.

Other entries in this section