Home/ Reference/ Fill

shape.Fill.UniformColor.HexValue

Hex color value, e.g. "#FFFF00". Call .upper() on the way out before comparing — CDR is inconsistent about case. Filtering yellow text in the code depends on this.

Signature

shape.Fill.UniformColor.HexValue

Notes

Hex color value, e.g. "#FFFF00". Call .upper() on the way out before comparing — CDR is inconsistent about case. Filtering yellow text in the code depends on this.

Python example (runnable)

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

# HexValue reads and writes; casing is inconsistent, so upper() before comparing
hex_now = (shape.Fill.UniformColor.HexValue or "").upper()
print("Colour: ", hex_now)

if hex_now == "#FFFF00":
    print("It is yellow, so apply the rule")

# you can also assign hex directly
# shape.Fill.UniformColor.HexValue = "#F8D731"

About this section: Fill

Fill — uniform, gradient and pattern fills.

Other entries in this section